diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2017-01-19 12:06:13 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2017-01-19 12:06:13 +0200 |
commit | b05bf8ff0f1acf39afeb71e0e8a148090364d8fc (patch) | |
tree | d104ee5ed8a27edd28f716319f91992ef8880411 /sql/item.cc | |
parent | 833aa97cec771fbfb2ef8dd104de6a3d1e971daa (diff) | |
parent | 03497129371fe2c16d847b7e83a5eeecab9c34a2 (diff) | |
download | mariadb-git-b05bf8ff0f1acf39afeb71e0e8a148090364d8fc.tar.gz |
Merge 10.1 to 10.2.
Most notably, this includes MDEV-11623, which includes a fix and
an upgrade procedure for the InnoDB file format incompatibility
that is present in MariaDB Server 10.1.0 through 10.1.20.
In other words, this merge should address
MDEV-11202 InnoDB 10.1 -> 10.2 migration does not work
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/item.cc b/sql/item.cc index 682f88317f1..8698b0f7fa4 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -544,7 +544,14 @@ uint Item::decimal_precision() const unsigned_flag); return MY_MIN(prec, DECIMAL_MAX_PRECISION); } - return MY_MIN(max_char_length(), DECIMAL_MAX_PRECISION); + uint res= max_char_length(); + /* + Return at least one decimal digit, even if Item::max_char_length() + returned 0. This is important to avoid attempts to create fields of types + INT(0) or DECIMAL(0,0) when converting NULL or empty strings to INT/DECIMAL: + CREATE TABLE t1 AS SELECT CONVERT(NULL,SIGNED) AS a; + */ + return res ? MY_MIN(res, DECIMAL_MAX_PRECISION) : 1; } |