summaryrefslogtreecommitdiff
path: root/sql/table.h
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2019-08-29 12:35:19 +0400
committerAlexander Barkov <bar@mariadb.com>2019-09-03 09:51:35 +0400
commitef00ac4c86daf3294c46a45358da636763fb0049 (patch)
tree833c4c4696dfe423eea4531b436b5080a0cb6077 /sql/table.h
parentdc719597ee0b11da722e9813639e8b48018a8c10 (diff)
downloadmariadb-git-ef00ac4c86daf3294c46a45358da636763fb0049.tar.gz
Part2: MDEV-18156 Assertion `0' failed or `btr_validate_index(index, 0, false)' in row_upd_sec_index_entry or error code 126: Index is corrupted upon DELETE with PAD_CHAR_TO_FULL_LENGTH
This patch allows the server to open old tables that have "bad" generated columns (i.e. indexed virtual generated columns, persistent generated columns) that depend on sql_mode, for general things like SELECT, INSERT, DROP, etc. Warning are issued in such cases. Only these commands are now disallowed and return an error: - CREATE TABLE introducing a "bad" generated column - ALTER TABLE introducing a "bad" generated column - CREATE INDEX introdicing a "bad" generated column (i.e. adding an index on a virtual generated column that depends on sql_mode). Note, these commands are allowed: - ALTER TABLE removing a "bad" generate column - ALTER TABLE removing an index from a "bad" virtual generated column - DROP INDEX removing an index from a "bad" virtual generated column but only if the table does not have any "bad" columns as a result.
Diffstat (limited to 'sql/table.h')
-rw-r--r--sql/table.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/sql/table.h b/sql/table.h
index 7786679982f..8f6a9e7aa86 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -325,6 +325,20 @@ enum tmp_table_type
};
enum release_type { RELEASE_NORMAL, RELEASE_WAIT_FOR_DROP };
+
+enum vcol_init_mode
+{
+ VCOL_INIT_DEPENDENCY_FAILURE_IS_WARNING= 1,
+ VCOL_INIT_DEPENDENCY_FAILURE_IS_ERROR= 2
+ /*
+ There may be new flags here.
+ e.g. to automatically remove sql_mode dependency:
+ GENERATED ALWAYS AS (char_col) ->
+ GENERATED ALWAYS AS (RTRIM(char_col))
+ */
+};
+
+
enum enum_vcol_update_mode
{
VCOL_UPDATE_FOR_READ= 0,
@@ -2736,7 +2750,7 @@ bool fix_session_vcol_expr(THD *thd, Virtual_column_info *vcol);
bool fix_session_vcol_expr_for_read(THD *thd, Field *field,
Virtual_column_info *vcol);
bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table,
- bool *error_reported);
+ bool *error_reported, vcol_init_mode expr);
TABLE_SHARE *alloc_table_share(const char *db, const char *table_name,
const char *key, uint key_length);
void init_tmp_table_share(THD *thd, TABLE_SHARE *share, const char *key,