Bug #29021730 CRASHING INNOBASE_COL_CHECK_FK WITH FOREIGN KEYS

PROBLEM
-------
Function innodb_base_col_setup_for_stored() was skipping to store
the base column information for a generated column if the base column
was a "STORED" generated column. This later causes a crash in function
innoabse_col_check_fk() where it says that a generated columns depends
upon two base columns ,but there is information on only one of them.
There was a explicit check barring the stored columns being stored,
which is wrong because the documentation says that a generated stored
column can be a part of a generated column.

FIX
----
Store the information of base column if it is a stored generated column.

#RB21247
Reviewed by: Debarun Banerjee <debarun.banerjee@oracle.com>
This commit is contained in:
Aditya A 2019-01-25 19:51:57 +05:30 committed by Marko Mäkelä
parent c795a9f3fe
commit f3a9f12bc3

View File

@ -1,6 +1,6 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2000, 2019, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc. Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc. Copyright (c) 2009, Percona Inc.
Copyright (c) 2012, Facebook Inc. Copyright (c) 2012, Facebook Inc.
@ -10977,7 +10977,7 @@ innodb_base_col_setup_for_stored(
for (uint i= 0; i < field->table->s->fields; ++i) { for (uint i= 0; i < field->table->s->fields; ++i) {
const Field* base_field = field->table->field[i]; const Field* base_field = field->table->field[i];
if (!base_field->vcol_info if (base_field->stored_in_db()
&& bitmap_is_set(&field->table->tmp_set, i)) { && bitmap_is_set(&field->table->tmp_set, i)) {
ulint z; ulint z;
for (z = 0; z < table->n_cols; z++) { for (z = 0; z < table->n_cols; z++) {