187
Check if the foreign key options are compatible with columns
188
on which the FK is created.
194
bool Foreign_key::validate(List<Create_field> &table_fields)
196
Create_field *sql_field;
197
Key_part_spec *column;
198
List_iterator<Key_part_spec> cols(columns);
199
List_iterator<Create_field> it(table_fields);
200
while ((column= cols++))
203
while ((sql_field= it++) &&
204
my_strcasecmp(system_charset_info,
205
column->field_name.str,
206
sql_field->field_name)) {}
209
my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), column->field_name.str);
212
if (type == Key::FOREIGN_KEY && sql_field->vcol_info)
214
if (delete_opt == FK_OPTION_SET_NULL)
216
my_error(ER_WRONG_FK_OPTION_FOR_VIRTUAL_COLUMN, MYF(0),
217
"ON DELETE SET NULL");
220
if (update_opt == FK_OPTION_SET_NULL)
222
my_error(ER_WRONG_FK_OPTION_FOR_VIRTUAL_COLUMN, MYF(0),
223
"ON UPDATE SET NULL");
226
if (update_opt == FK_OPTION_CASCADE)
228
my_error(ER_WRONG_FK_OPTION_FOR_VIRTUAL_COLUMN, MYF(0),
229
"ON UPDATE CASCADE");
186
238
/****************************************************************************
187
239
** Thread specific functions
188
240
****************************************************************************/