summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-03-18 08:44:24 +0100
committerSergei Golubchik <sergii@pisem.net>2013-03-18 08:44:24 +0100
commit8f607aae127439e132dae00b2750727162f4d564 (patch)
tree2a470ac1ca3ad8c0f9e782d9ed0edcaadf112538 /mysql-test
parent3827d70a0edb9b88f30dd64a2d7ee2853524dd4e (diff)
downloadmariadb-git-8f607aae127439e132dae00b2750727162f4d564.tar.gz
MDEV-4283 Assertion `scale <= precision' fails in strings/decimal.c
with decimals=NOT_FIXED_DEC it is possible to have 'decimals' larger than 'max_length', it's not an error for temporal functions. But when Item_func_numhybrid converts the value to DECIMAL_RESULT, it must limit 'decimals' to be a valid scale of a decimal number.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/temporal_scale_4283.result12
-rw-r--r--mysql-test/t/temporal_scale_4283.test13
2 files changed, 25 insertions, 0 deletions
diff --git a/mysql-test/r/temporal_scale_4283.result b/mysql-test/r/temporal_scale_4283.result
new file mode 100644
index 00000000000..685a6192a97
--- /dev/null
+++ b/mysql-test/r/temporal_scale_4283.result
@@ -0,0 +1,12 @@
+create table t1 (a int);
+insert into t1 values (4),(8);
+select distinct 100 mod timestampadd( week, a, '2002-05-20' ) from t1;
+100 mod timestampadd( week, a, '2002-05-20' )
+100
+drop table t1;
+create table t1 (i int);
+insert into t1 values (2),(4);
+select distinct convert_tz( '2001-03-21', 'utc', 'met' ) mod i from t1;
+convert_tz( '2001-03-21', 'utc', 'met' ) mod i
+0
+drop table t1;
diff --git a/mysql-test/t/temporal_scale_4283.test b/mysql-test/t/temporal_scale_4283.test
new file mode 100644
index 00000000000..d79ca7caa54
--- /dev/null
+++ b/mysql-test/t/temporal_scale_4283.test
@@ -0,0 +1,13 @@
+#
+# MDEV-4283 Assertion `scale <= precision' fails in strings/decimal.c
+#
+create table t1 (a int);
+insert into t1 values (4),(8);
+select distinct 100 mod timestampadd( week, a, '2002-05-20' ) from t1;
+drop table t1;
+
+create table t1 (i int);
+insert into t1 values (2),(4);
+select distinct convert_tz( '2001-03-21', 'utc', 'met' ) mod i from t1;
+drop table t1;
+