diff options
author | Gleb Shchepa <gleb.shchepa@oracle.com> | 2012-06-29 12:55:45 +0400 |
---|---|---|
committer | Gleb Shchepa <gleb.shchepa@oracle.com> | 2012-06-29 12:55:45 +0400 |
commit | ba966cff983ff71fa0c88f6b6a8f15afbf0230f1 (patch) | |
tree | 7f5c6c4320c4997d6be1e35c5562c5795a1efc72 /sql/field.cc | |
parent | 537f770633c9755528872abc02b011307e0563be (diff) | |
download | mariadb-git-ba966cff983ff71fa0c88f6b6a8f15afbf0230f1.tar.gz |
Backport of the deprecation warning from WL#6219: "Deprecate and remove YEAR(2) type"
Print the warning(note):
YEAR(x) is deprecated and will be removed in a future release. Please use YEAR(4) instead
on "CREATE TABLE ... YEAR(x)" or "ALTER TABLE MODIFY ... YEAR(x)", where x != 4
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sql/field.cc b/sql/field.cc index f398642fdb0..1c937755c0c 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -10227,6 +10227,17 @@ Create_field::Create_field(Field *old_field,Field *orig_field) geom_type= ((Field_geom*)old_field)->geom_type; break; #endif + case MYSQL_TYPE_YEAR: + if (length != 4) + { + char buff[sizeof("YEAR()") + MY_INT64_NUM_DECIMAL_DIGITS + 1]; + snprintf(buff, sizeof(buff), "YEAR(%lu)", length); + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_NOTE, + ER_WARN_DEPRECATED_SYNTAX, + ER(ER_WARN_DEPRECATED_SYNTAX), + buff, "YEAR(4)"); + } + break; default: break; } |