mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug #17852083 PRINT A WARNING WHEN DDL HAS AN ERROR IN INNODB_STRICT_MODE = 1
Problem: Creation of a table fails when innodb_strict_mode is enabled, but the same table is created without any warning when innodb_strict_mode is enabled. Solution: If creation of a table fails with an error when innodb_strict_mode is enabled, it must issue a warning when innodb_strict_mode is disabled. rb#6723 approved by Krunal.
This commit is contained in:
242
mysql-test/suite/innodb/r/strict_mode.result
Normal file
242
mysql-test/suite/innodb/r/strict_mode.result
Normal file
@ -0,0 +1,242 @@
|
|||||||
|
#
|
||||||
|
# Bug #17852083 PRINT A WARNING WHEN DDL HAS AN ERROR IN
|
||||||
|
# INNODB_STRICT_MODE = 1
|
||||||
|
#
|
||||||
|
set innodb_strict_mode = 0;
|
||||||
|
create table t1 (id int auto_increment primary key,
|
||||||
|
v varchar(32),
|
||||||
|
col1 text,
|
||||||
|
col2 text,
|
||||||
|
col3 text,
|
||||||
|
col4 text,
|
||||||
|
col5 text,
|
||||||
|
col6 text,
|
||||||
|
col7 text,
|
||||||
|
col8 text,
|
||||||
|
col9 text,
|
||||||
|
col10 text,
|
||||||
|
col11 text,
|
||||||
|
col12 text,
|
||||||
|
col13 text,
|
||||||
|
col14 text,
|
||||||
|
col15 text,
|
||||||
|
col16 text,
|
||||||
|
col17 text,
|
||||||
|
col18 text,
|
||||||
|
col19 text,
|
||||||
|
col20 text,
|
||||||
|
col21 text,
|
||||||
|
col22 text,
|
||||||
|
col23 text,
|
||||||
|
col24 text,
|
||||||
|
col25 text,
|
||||||
|
col26 text,
|
||||||
|
col27 text,
|
||||||
|
col28 text,
|
||||||
|
col29 text,
|
||||||
|
col30 text,
|
||||||
|
col31 text,
|
||||||
|
col32 text,
|
||||||
|
col33 text,
|
||||||
|
col34 text,
|
||||||
|
col35 text,
|
||||||
|
col36 text,
|
||||||
|
col37 text,
|
||||||
|
col38 text,
|
||||||
|
col39 text,
|
||||||
|
col40 text,
|
||||||
|
col41 text,
|
||||||
|
col42 text,
|
||||||
|
col43 text,
|
||||||
|
col44 text,
|
||||||
|
col45 text ,
|
||||||
|
col46 text,
|
||||||
|
col47 text,
|
||||||
|
col48 text,
|
||||||
|
col49 text,
|
||||||
|
col50 text,
|
||||||
|
col51 text,
|
||||||
|
col52 text,
|
||||||
|
col53 text,
|
||||||
|
col54 text,
|
||||||
|
col55 text,
|
||||||
|
col56 text,
|
||||||
|
col57 text,
|
||||||
|
col58 text,
|
||||||
|
col59 text,
|
||||||
|
col60 text,
|
||||||
|
col61 text,
|
||||||
|
col62 text,
|
||||||
|
col63 text,
|
||||||
|
col64 text,
|
||||||
|
col65 text,
|
||||||
|
col66 text,
|
||||||
|
col67 text,
|
||||||
|
col68 text ,
|
||||||
|
col69 text,
|
||||||
|
col70 text,
|
||||||
|
col71 text,
|
||||||
|
col72 text,
|
||||||
|
col73 text,
|
||||||
|
col74 text,
|
||||||
|
col75 text,
|
||||||
|
col76 text,
|
||||||
|
col77 text,
|
||||||
|
col78 text,
|
||||||
|
col79 text,
|
||||||
|
col80 text,
|
||||||
|
col81 text,
|
||||||
|
col82 text,
|
||||||
|
col83 text,
|
||||||
|
col84 text,
|
||||||
|
col85 text,
|
||||||
|
col86 text,
|
||||||
|
col87 text,
|
||||||
|
col88 text,
|
||||||
|
col89 text,
|
||||||
|
col90 text,
|
||||||
|
col91 text,
|
||||||
|
col92 text,
|
||||||
|
col93 text,
|
||||||
|
col94 text,
|
||||||
|
col95 text,
|
||||||
|
col96 text,
|
||||||
|
col97 text,
|
||||||
|
col98 text,
|
||||||
|
col99 text,
|
||||||
|
col100 text,
|
||||||
|
col101 text,
|
||||||
|
col102 text,
|
||||||
|
col103 text,
|
||||||
|
col104 text,
|
||||||
|
col105 text,
|
||||||
|
col106 text,
|
||||||
|
col107 text,
|
||||||
|
col108 text,
|
||||||
|
col109 text,
|
||||||
|
col110 text,
|
||||||
|
col111 text,
|
||||||
|
col112 text,
|
||||||
|
col113 text,
|
||||||
|
col114 text,
|
||||||
|
col115 text,
|
||||||
|
col116 text,
|
||||||
|
col117 text,
|
||||||
|
col118 text,
|
||||||
|
col119 text,
|
||||||
|
col120 text,
|
||||||
|
col121 text,
|
||||||
|
col122 text,
|
||||||
|
col123 text,
|
||||||
|
col124 text,
|
||||||
|
col125 text,
|
||||||
|
col126 text ,
|
||||||
|
col127 text,
|
||||||
|
col128 text,
|
||||||
|
col129 text,
|
||||||
|
col130 text,
|
||||||
|
col131 text,
|
||||||
|
col132 text,
|
||||||
|
col133 text,
|
||||||
|
col134 text,
|
||||||
|
col135 text,
|
||||||
|
col136 text,
|
||||||
|
col137 text,
|
||||||
|
col138 text,
|
||||||
|
col139 text,
|
||||||
|
col140 text,
|
||||||
|
col141 text,
|
||||||
|
col142 text,
|
||||||
|
col143 text,
|
||||||
|
col144 text,
|
||||||
|
col145 text,
|
||||||
|
col146 text,
|
||||||
|
col147 text ,
|
||||||
|
col148 text,
|
||||||
|
col149 text,
|
||||||
|
col150 text,
|
||||||
|
col151 text,
|
||||||
|
col152 text,
|
||||||
|
col153 text,
|
||||||
|
col154 text,
|
||||||
|
col155 text,
|
||||||
|
col156 text,
|
||||||
|
col157 text,
|
||||||
|
col158 text,
|
||||||
|
col159 text,
|
||||||
|
col160 text,
|
||||||
|
col161 text,
|
||||||
|
col162 text,
|
||||||
|
col163 text,
|
||||||
|
col164 text,
|
||||||
|
col165 text,
|
||||||
|
col166 text,
|
||||||
|
col167 text,
|
||||||
|
col168 text,
|
||||||
|
col169 text,
|
||||||
|
col170 text,
|
||||||
|
col171 text,
|
||||||
|
col172 text ,
|
||||||
|
col173 text,
|
||||||
|
col174 text,
|
||||||
|
col175 text,
|
||||||
|
col176 text,
|
||||||
|
col177 text,
|
||||||
|
col178 text,
|
||||||
|
col179 text,
|
||||||
|
col180 text,
|
||||||
|
col181 text,
|
||||||
|
col182 text,
|
||||||
|
col183 text,
|
||||||
|
col184 text,
|
||||||
|
col185 text,
|
||||||
|
col186 text,
|
||||||
|
col187 text,
|
||||||
|
col188 text,
|
||||||
|
col189 text,
|
||||||
|
col190 text,
|
||||||
|
col191 text,
|
||||||
|
col192 text,
|
||||||
|
col193 text,
|
||||||
|
col194 text,
|
||||||
|
col195 text,
|
||||||
|
col196 text,
|
||||||
|
col197 text,
|
||||||
|
col198 text,
|
||||||
|
col199 text,
|
||||||
|
col200 text,
|
||||||
|
col201 text,
|
||||||
|
col202 text,
|
||||||
|
col203 text,
|
||||||
|
col204 text,
|
||||||
|
col205 text,
|
||||||
|
col206 text,
|
||||||
|
col207 text,
|
||||||
|
col208 text,
|
||||||
|
col209 text,
|
||||||
|
col210 text,
|
||||||
|
col211 text,
|
||||||
|
col212 text,
|
||||||
|
col213 text,
|
||||||
|
col214 text,
|
||||||
|
col215 text,
|
||||||
|
col216 text,
|
||||||
|
col217 text,
|
||||||
|
col218 text,
|
||||||
|
col219 text,
|
||||||
|
col220 text,
|
||||||
|
col221 text,
|
||||||
|
col222 text,
|
||||||
|
col223 text,
|
||||||
|
col224 text,
|
||||||
|
col225 text,
|
||||||
|
col226 text,
|
||||||
|
col227 text,
|
||||||
|
col228 text
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
Warnings:
|
||||||
|
Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
|
||||||
|
set innodb_strict_mode = 1;
|
||||||
|
alter table t1 engine=InnoDB;
|
||||||
|
ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
|
||||||
|
drop table t1;
|
246
mysql-test/suite/innodb/t/strict_mode.test
Normal file
246
mysql-test/suite/innodb/t/strict_mode.test
Normal file
@ -0,0 +1,246 @@
|
|||||||
|
--source include/have_innodb.inc
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug #17852083 PRINT A WARNING WHEN DDL HAS AN ERROR IN
|
||||||
|
--echo # INNODB_STRICT_MODE = 1
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
set innodb_strict_mode = 0;
|
||||||
|
|
||||||
|
create table t1 (id int auto_increment primary key,
|
||||||
|
v varchar(32),
|
||||||
|
col1 text,
|
||||||
|
col2 text,
|
||||||
|
col3 text,
|
||||||
|
col4 text,
|
||||||
|
col5 text,
|
||||||
|
col6 text,
|
||||||
|
col7 text,
|
||||||
|
col8 text,
|
||||||
|
col9 text,
|
||||||
|
col10 text,
|
||||||
|
col11 text,
|
||||||
|
col12 text,
|
||||||
|
col13 text,
|
||||||
|
col14 text,
|
||||||
|
col15 text,
|
||||||
|
col16 text,
|
||||||
|
col17 text,
|
||||||
|
col18 text,
|
||||||
|
col19 text,
|
||||||
|
col20 text,
|
||||||
|
col21 text,
|
||||||
|
col22 text,
|
||||||
|
col23 text,
|
||||||
|
col24 text,
|
||||||
|
col25 text,
|
||||||
|
col26 text,
|
||||||
|
col27 text,
|
||||||
|
col28 text,
|
||||||
|
col29 text,
|
||||||
|
col30 text,
|
||||||
|
col31 text,
|
||||||
|
col32 text,
|
||||||
|
col33 text,
|
||||||
|
col34 text,
|
||||||
|
col35 text,
|
||||||
|
col36 text,
|
||||||
|
col37 text,
|
||||||
|
col38 text,
|
||||||
|
col39 text,
|
||||||
|
col40 text,
|
||||||
|
col41 text,
|
||||||
|
col42 text,
|
||||||
|
col43 text,
|
||||||
|
col44 text,
|
||||||
|
col45 text ,
|
||||||
|
col46 text,
|
||||||
|
col47 text,
|
||||||
|
col48 text,
|
||||||
|
col49 text,
|
||||||
|
col50 text,
|
||||||
|
col51 text,
|
||||||
|
col52 text,
|
||||||
|
col53 text,
|
||||||
|
col54 text,
|
||||||
|
col55 text,
|
||||||
|
col56 text,
|
||||||
|
col57 text,
|
||||||
|
col58 text,
|
||||||
|
col59 text,
|
||||||
|
col60 text,
|
||||||
|
col61 text,
|
||||||
|
col62 text,
|
||||||
|
col63 text,
|
||||||
|
col64 text,
|
||||||
|
col65 text,
|
||||||
|
col66 text,
|
||||||
|
col67 text,
|
||||||
|
col68 text ,
|
||||||
|
col69 text,
|
||||||
|
col70 text,
|
||||||
|
col71 text,
|
||||||
|
col72 text,
|
||||||
|
col73 text,
|
||||||
|
col74 text,
|
||||||
|
col75 text,
|
||||||
|
col76 text,
|
||||||
|
col77 text,
|
||||||
|
col78 text,
|
||||||
|
col79 text,
|
||||||
|
col80 text,
|
||||||
|
col81 text,
|
||||||
|
col82 text,
|
||||||
|
col83 text,
|
||||||
|
col84 text,
|
||||||
|
col85 text,
|
||||||
|
col86 text,
|
||||||
|
col87 text,
|
||||||
|
col88 text,
|
||||||
|
col89 text,
|
||||||
|
col90 text,
|
||||||
|
col91 text,
|
||||||
|
col92 text,
|
||||||
|
col93 text,
|
||||||
|
col94 text,
|
||||||
|
col95 text,
|
||||||
|
col96 text,
|
||||||
|
col97 text,
|
||||||
|
col98 text,
|
||||||
|
col99 text,
|
||||||
|
col100 text,
|
||||||
|
col101 text,
|
||||||
|
col102 text,
|
||||||
|
col103 text,
|
||||||
|
col104 text,
|
||||||
|
col105 text,
|
||||||
|
col106 text,
|
||||||
|
col107 text,
|
||||||
|
col108 text,
|
||||||
|
col109 text,
|
||||||
|
col110 text,
|
||||||
|
col111 text,
|
||||||
|
col112 text,
|
||||||
|
col113 text,
|
||||||
|
col114 text,
|
||||||
|
col115 text,
|
||||||
|
col116 text,
|
||||||
|
col117 text,
|
||||||
|
col118 text,
|
||||||
|
col119 text,
|
||||||
|
col120 text,
|
||||||
|
col121 text,
|
||||||
|
col122 text,
|
||||||
|
col123 text,
|
||||||
|
col124 text,
|
||||||
|
col125 text,
|
||||||
|
col126 text ,
|
||||||
|
col127 text,
|
||||||
|
col128 text,
|
||||||
|
col129 text,
|
||||||
|
col130 text,
|
||||||
|
col131 text,
|
||||||
|
col132 text,
|
||||||
|
col133 text,
|
||||||
|
col134 text,
|
||||||
|
col135 text,
|
||||||
|
col136 text,
|
||||||
|
col137 text,
|
||||||
|
col138 text,
|
||||||
|
col139 text,
|
||||||
|
col140 text,
|
||||||
|
col141 text,
|
||||||
|
col142 text,
|
||||||
|
col143 text,
|
||||||
|
col144 text,
|
||||||
|
col145 text,
|
||||||
|
col146 text,
|
||||||
|
col147 text ,
|
||||||
|
col148 text,
|
||||||
|
col149 text,
|
||||||
|
col150 text,
|
||||||
|
col151 text,
|
||||||
|
col152 text,
|
||||||
|
col153 text,
|
||||||
|
col154 text,
|
||||||
|
col155 text,
|
||||||
|
col156 text,
|
||||||
|
col157 text,
|
||||||
|
col158 text,
|
||||||
|
col159 text,
|
||||||
|
col160 text,
|
||||||
|
col161 text,
|
||||||
|
col162 text,
|
||||||
|
col163 text,
|
||||||
|
col164 text,
|
||||||
|
col165 text,
|
||||||
|
col166 text,
|
||||||
|
col167 text,
|
||||||
|
col168 text,
|
||||||
|
col169 text,
|
||||||
|
col170 text,
|
||||||
|
col171 text,
|
||||||
|
col172 text ,
|
||||||
|
col173 text,
|
||||||
|
col174 text,
|
||||||
|
col175 text,
|
||||||
|
col176 text,
|
||||||
|
col177 text,
|
||||||
|
col178 text,
|
||||||
|
col179 text,
|
||||||
|
col180 text,
|
||||||
|
col181 text,
|
||||||
|
col182 text,
|
||||||
|
col183 text,
|
||||||
|
col184 text,
|
||||||
|
col185 text,
|
||||||
|
col186 text,
|
||||||
|
col187 text,
|
||||||
|
col188 text,
|
||||||
|
col189 text,
|
||||||
|
col190 text,
|
||||||
|
col191 text,
|
||||||
|
col192 text,
|
||||||
|
col193 text,
|
||||||
|
col194 text,
|
||||||
|
col195 text,
|
||||||
|
col196 text,
|
||||||
|
col197 text,
|
||||||
|
col198 text,
|
||||||
|
col199 text,
|
||||||
|
col200 text,
|
||||||
|
col201 text,
|
||||||
|
col202 text,
|
||||||
|
col203 text,
|
||||||
|
col204 text,
|
||||||
|
col205 text,
|
||||||
|
col206 text,
|
||||||
|
col207 text,
|
||||||
|
col208 text,
|
||||||
|
col209 text,
|
||||||
|
col210 text,
|
||||||
|
col211 text,
|
||||||
|
col212 text,
|
||||||
|
col213 text,
|
||||||
|
col214 text,
|
||||||
|
col215 text,
|
||||||
|
col216 text,
|
||||||
|
col217 text,
|
||||||
|
col218 text,
|
||||||
|
col219 text,
|
||||||
|
col220 text,
|
||||||
|
col221 text,
|
||||||
|
col222 text,
|
||||||
|
col223 text,
|
||||||
|
col224 text,
|
||||||
|
col225 text,
|
||||||
|
col226 text,
|
||||||
|
col227 text,
|
||||||
|
col228 text
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
set innodb_strict_mode = 1;
|
||||||
|
--error ER_TOO_BIG_ROWSIZE
|
||||||
|
alter table t1 engine=InnoDB;
|
||||||
|
|
||||||
|
drop table t1;
|
@ -42,6 +42,12 @@ UNIV_INTERN dict_index_t* dict_ind_compact;
|
|||||||
UNIV_INTERN uint ibuf_debug;
|
UNIV_INTERN uint ibuf_debug;
|
||||||
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
|
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
Issue a warning that the row is too big. */
|
||||||
|
void
|
||||||
|
ib_warn_row_too_big(const dict_table_t* table);
|
||||||
|
|
||||||
|
|
||||||
#ifndef UNIV_HOTBACKUP
|
#ifndef UNIV_HOTBACKUP
|
||||||
#include "buf0buf.h"
|
#include "buf0buf.h"
|
||||||
#include "data0type.h"
|
#include "data0type.h"
|
||||||
@ -1765,11 +1771,18 @@ dict_index_add_to_cache(
|
|||||||
|
|
||||||
new_index->n_fields = new_index->n_def;
|
new_index->n_fields = new_index->n_def;
|
||||||
|
|
||||||
if (strict && dict_index_too_big_for_tree(table, new_index)) {
|
if (dict_index_too_big_for_tree(table, new_index)) {
|
||||||
|
|
||||||
|
if (strict) {
|
||||||
too_big:
|
too_big:
|
||||||
dict_mem_index_free(new_index);
|
dict_mem_index_free(new_index);
|
||||||
dict_mem_index_free(index);
|
dict_mem_index_free(index);
|
||||||
return(DB_TOO_BIG_RECORD);
|
return(DB_TOO_BIG_RECORD);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
ib_warn_row_too_big(table);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UNIV_UNLIKELY(index->type & DICT_UNIVERSAL)) {
|
if (UNIV_UNLIKELY(index->type & DICT_UNIVERSAL)) {
|
||||||
|
@ -12063,3 +12063,30 @@ innobase_convert_to_filename_charset(
|
|||||||
|
|
||||||
return(strconvert(cs_from, from, cs_to, to, len, &errors));
|
return(strconvert(cs_from, from, cs_to, to, len, &errors));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
Issue a warning that the row is too big. */
|
||||||
|
extern "C"
|
||||||
|
void
|
||||||
|
ib_warn_row_too_big(const dict_table_t* table)
|
||||||
|
{
|
||||||
|
/* If prefix is true then a 768-byte prefix is stored
|
||||||
|
locally for BLOB fields. Refer to dict_table_get_format() */
|
||||||
|
const bool prefix = ((table->flags & DICT_TF_FORMAT_MASK)
|
||||||
|
>> DICT_TF_FORMAT_SHIFT) < UNIV_FORMAT_B;
|
||||||
|
|
||||||
|
const ulint free_space = page_get_free_space_of_empty(
|
||||||
|
table->flags & DICT_TF_COMPACT) / 2;
|
||||||
|
|
||||||
|
THD* thd = current_thd;
|
||||||
|
|
||||||
|
push_warning_printf(
|
||||||
|
thd, MYSQL_ERROR::WARN_LEVEL_WARN, HA_ERR_TO_BIG_ROW,
|
||||||
|
"Row size too large (> %lu). Changing some columns to TEXT"
|
||||||
|
" or BLOB %smay help. In current row format, BLOB prefix of"
|
||||||
|
" %d bytes is stored inline.", free_space
|
||||||
|
, prefix ? "or using ROW_FORMAT=DYNAMIC or"
|
||||||
|
" ROW_FORMAT=COMPRESSED ": ""
|
||||||
|
, prefix ? DICT_MAX_FIXED_COL_LEN : 0);
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user