From 72a71a710ed608a5d8bc3e3f1a0ae82027945545 Mon Sep 17 00:00:00 2001 From: Downal <469743591@qq.com> Date: Mon, 29 May 2023 17:06:29 +0800 Subject: [PATCH] fix(tianmu): provide error information for "create constraint and foreign keys"(not supported) --- share/messages_to_clients.txt | 3 +++ sql/sql_table.cc | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/share/messages_to_clients.txt b/share/messages_to_clients.txt index 0270bf922..b80d9a683 100644 --- a/share/messages_to_clients.txt +++ b/share/messages_to_clients.txt @@ -9806,6 +9806,9 @@ ER_CREATE_SELECT_WITH_GIPK_DISALLOWED_IN_SBR ER_DA_EXPIRE_LOGS_DAYS_IGNORED eng "The option expire_logs_days cannot be used together with option binlog_expire_logs_seconds. To set one, first unset the other by setting it to 0." +ER_TIANMU_NOT_SUPPORTED_FOREIGN_KEY + eng "Tianmu engine dose not support foreign key." + # # End of 8.0 error messages (server-to-client). # Do NOT add messages intended for the error log above! diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 5f440deb6..133444ffb 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -6514,7 +6514,10 @@ static bool prepare_foreign_key(THD *thd, HA_CREATE_INFO *create_info, // the FK has been made, it is enough to check it for new FKs. if (fk_key->validate(thd, table_name, alter_info->create_list)) return true; - if (!se_supports_fks) return false; + if (!se_supports_fks) { + my_error(ER_TIANMU_NOT_SUPPORTED_FOREIGN_KEY, MYF(0)); + return true; + } if (fk_key->has_explicit_name) { assert(fk_key->name.str);