summaryrefslogtreecommitdiff
path: root/mysql-test/r/null.result
diff options
context:
space:
mode:
authorunknown <gshchepa/uchum@gleb.loc>2007-10-10 20:14:29 +0500
committerunknown <gshchepa/uchum@gleb.loc>2007-10-10 20:14:29 +0500
commitc866f8015fcfd56c42f52865c0e89a50c055f6f8 (patch)
treea19eadf72920454b1d8a34ad78b169d71dd0600b /mysql-test/r/null.result
parent6146c0c75d013b15ea2c6656ee0d774498734fd2 (diff)
downloadmariadb-git-c866f8015fcfd56c42f52865c0e89a50c055f6f8.tar.gz
Fixed bug #31471: decimal_bin_size: Assertion `scale >= 0 &&
precision > 0 && scale <= precision'. A sign of a resulting item of the IFNULL function was not updated and the maximal length of this result was calculated improperly. Correct algorithm was copy&pasted from the IF function implementation. sql/item_cmpfunc.cc: Fixed bug #31471. The Item_func_ifnull::fix_length_and_dec method has been modified to update the Item_func_ifnull::unsigned_flag field and to take this field into account when calculating the Item_func_ifnull::max_length value. (See Item_func_if::fix_length_and_dec for reference). mysql-test/t/null.test: Added test case for bug #31471. mysql-test/r/null.result: Added test case for bug #31471. mysql-test/r/create.result: Update test case after the bugfix of bug #31471.
Diffstat (limited to 'mysql-test/r/null.result')
-rw-r--r--mysql-test/r/null.result25
1 files changed, 24 insertions, 1 deletions
diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result
index c33adee76b2..090f41baec3 100644
--- a/mysql-test/r/null.result
+++ b/mysql-test/r/null.result
@@ -1,4 +1,4 @@
-drop table if exists t1;
+drop table if exists t1, t2;
select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull(null,"TRUE"),ifnull("TRUE","ERROR"),1/0 is null,1 is not null;
NULL NULL isnull(null) isnull(1/0) isnull(1/0 = null) ifnull(null,1) ifnull(null,"TRUE") ifnull("TRUE","ERROR") 1/0 is null 1 is not null
NULL NULL 1 1 1 1 TRUE TRUE 1 1
@@ -320,3 +320,26 @@ bug19145c CREATE TABLE `bug19145c` (
drop table bug19145a;
drop table bug19145b;
drop table bug19145c;
+# End of 4.1 tests
+#
+# Bug #31471: decimal_bin_size: Assertion `scale >= 0 &&
+# precision > 0 && scale <= precision'
+#
+CREATE TABLE t1 (a DECIMAL (1, 0) ZEROFILL, b DECIMAL (1, 0) ZEROFILL);
+INSERT INTO t1 (a, b) VALUES (0, 0);
+CREATE TABLE t2 SELECT IFNULL(a, b) FROM t1;
+DESCRIBE t2;
+Field Type Null Key Default Extra
+IFNULL(a, b) decimal(1,0) unsigned YES NULL
+DROP TABLE t2;
+CREATE TABLE t2 SELECT IFNULL(a, NULL) FROM t1;
+DESCRIBE t2;
+Field Type Null Key Default Extra
+IFNULL(a, NULL) decimal(1,0) YES NULL
+DROP TABLE t2;
+CREATE TABLE t2 SELECT IFNULL(NULL, b) FROM t1;
+DESCRIBE t2;
+Field Type Null Key Default Extra
+IFNULL(NULL, b) decimal(1,0) YES NULL
+DROP TABLE t1, t2;
+# End of 5.0 tests