summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <sanja@askmonty.org>2013-03-06 21:10:58 +0200
committerunknown <sanja@askmonty.org>2013-03-06 21:10:58 +0200
commit108a0a1823db2036000b309e7d6bd3216742c4de (patch)
tree2fee2f63610f270bf064e29152724cb8c697446f /mysql-test
parent4ad2fd7cdf1b95b73081f9fe61eae590504e455e (diff)
downloadmariadb-git-108a0a1823db2036000b309e7d6bd3216742c4de.tar.gz
MDEV-4241 fix.
Field_enum incorrectly inherited decimals() from Field_string. Field_enum should be always integer in numeric context.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/type_enum.result15
-rw-r--r--mysql-test/t/type_enum.test15
2 files changed, 30 insertions, 0 deletions
diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result
index 813f912c5af..390f969f313 100644
--- a/mysql-test/r/type_enum.result
+++ b/mysql-test/r/type_enum.result
@@ -1854,3 +1854,18 @@ a
DROP TABLE t1;
End of 5.1 tests
+#
+# MDEV-4241: Assertion failure: scale >= 0 && precision > 0 &&
+# scale <= precision in decimal_bin_size
+#
+CREATE TABLE t1 (
+f1 enum('1','2','3','4','5')
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+SELECT AVG(f1) FROM t1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def AVG(f1) 246 7 6 Y 128 4 63
+AVG(f1)
+1.5000
+drop table t1;
+End of 5.3 tests
diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test
index 2043342e2c8..5b0b70631a5 100644
--- a/mysql-test/t/type_enum.test
+++ b/mysql-test/t/type_enum.test
@@ -221,3 +221,18 @@ SELECT a FROM t1 WHERE a=0;
DROP TABLE t1;
--echo End of 5.1 tests
+
+--echo #
+--echo # MDEV-4241: Assertion failure: scale >= 0 && precision > 0 &&
+--echo # scale <= precision in decimal_bin_size
+--echo #
+CREATE TABLE t1 (
+ f1 enum('1','2','3','4','5')
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+--enable_metadata
+SELECT AVG(f1) FROM t1;
+--disable_metadata
+drop table t1;
+
+--echo End of 5.3 tests