summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/share/errmsg-utf8.txt2
-rw-r--r--sql/table.cc6
2 files changed, 7 insertions, 1 deletions
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index 77347472521..42c5505d607 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -7919,3 +7919,5 @@ ER_VERS_QUERY_IN_PARTITION
eng "SYSTEM_TIME partitions in table %`s does not support historical query"
ER_KEY_DOESNT_SUPPORT
eng "%s index %`s does not support this operation"
+ER_FIELD_CONSTRAINT_FAILED
+ eng "FIELD CONSTRAINT %`s failed for %`-.192s.%`-.192s"
diff --git a/sql/table.cc b/sql/table.cc
index ced8f8c0ae8..8b33ccd8675 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -5243,7 +5243,11 @@ int TABLE::verify_constraints(bool ignore_failure)
if (((*chk)->expr->val_int() == 0 && !(*chk)->expr->null_value) ||
in_use->is_error())
{
- my_error(ER_CONSTRAINT_FAILED,
+ enum_vcol_info_type vcol_type= (*chk)->get_vcol_type();
+ DBUG_ASSERT(vcol_type == VCOL_CHECK_TABLE ||
+ vcol_type == VCOL_CHECK_FIELD);
+ my_error(vcol_type == VCOL_CHECK_TABLE ? ER_CONSTRAINT_FAILED :
+ ER_FIELD_CONSTRAINT_FAILED,
MYF(ignore_failure ? ME_JUST_WARNING : 0), (*chk)->name.str,
s->db.str, s->table_name.str);
return ignore_failure ? VIEW_CHECK_SKIP : VIEW_CHECK_ERROR;