summaryrefslogtreecommitdiff
path: root/sql/sql_yacc.yy
diff options
context:
space:
mode:
authorGleb Shchepa <gleb.shchepa@oracle.com>2012-06-29 14:12:21 +0400
committerGleb Shchepa <gleb.shchepa@oracle.com>2012-06-29 14:12:21 +0400
commit47c1ce35e2ce9b9e756be17ab3a1ce309eea12c8 (patch)
treeaa3c60456b0b32facebea115b86bbc0b63d1aa9d /sql/sql_yacc.yy
parent5a2ae8f4ee1387bb818b4e53cef85e185755d22f (diff)
parentba966cff983ff71fa0c88f6b6a8f15afbf0230f1 (diff)
downloadmariadb-git-47c1ce35e2ce9b9e756be17ab3a1ce309eea12c8.tar.gz
manual merge (WL6219)
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r--sql/sql_yacc.yy18
1 files changed, 17 insertions, 1 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index bf7ca6b02ed..05a12ac826a 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -5465,7 +5465,23 @@ type:
$$= MYSQL_TYPE_VARCHAR;
}
| YEAR_SYM opt_field_length field_options
- { $$=MYSQL_TYPE_YEAR; }
+ {
+ if (Lex->length)
+ {
+ errno= 0;
+ ulong length= strtoul(Lex->length, NULL, 10);
+ if (errno == 0 && length <= MAX_FIELD_BLOBLENGTH && length != 4)
+ {
+ char buff[sizeof("YEAR()") + MY_INT64_NUM_DECIMAL_DIGITS + 1];
+ snprintf(buff, sizeof(buff), "YEAR(%lu)", length);
+ push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_WARN_DEPRECATED_SYNTAX,
+ ER(ER_WARN_DEPRECATED_SYNTAX),
+ buff, "YEAR(4)");
+ }
+ }
+ $$=MYSQL_TYPE_YEAR;
+ }
| DATE_SYM
{ $$=MYSQL_TYPE_DATE; }
| TIME_SYM