maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #03478
Re: [Fwd: [Commits] bzr commit into Mariadb 5.2, with Maria 2.0:maria/5.2 branch (igor:2827) Bug#607177]
Hello Igor,
Ok to push.
On Tue, Jul 20, 2010 at 10:01:30PM -0700, Igor Babaev wrote:
> Sergey,
>
> Please review this trivial patch for the 5.2 tree.
>
> Regards,
> Igor.
>
> -------- Original Message --------
> Subject: [Commits] bzr commit into Mariadb 5.2, with Maria 2.0:maria/5.2
> branch (igor:2827) Bug#607177
> Date: Tue, 20 Jul 2010 22:00:00 -0700 (PDT)
> From: Igor Babaev <igor@xxxxxxxxxxxx>
> Reply-To: maria-developers@xxxxxxxxxxxxxxxxxxx
> To: commits@xxxxxxxxxxx
>
> #At lp:maria/5.2 based on
> revid:igor@xxxxxxxxxxxx-20100717195808-mvh782jvt6c32u2d
>
> 2827 Igor Babaev 2010-07-20
> Fixed bug #607177.
> Due to an invalid check for NULL of the second argument of the
> Item_func_round items performed in the code of
> Item_func_round::real_op
> the function ROUND sometimes could return wrong results.
> modified:
> mysql-test/suite/vcol/r/vcol_misc.result
> mysql-test/suite/vcol/t/vcol_misc.test
> sql/item_func.cc
>
> === modified file 'mysql-test/suite/vcol/r/vcol_misc.result'
> --- a/mysql-test/suite/vcol/r/vcol_misc.result 2010-07-17 19:58:08 +0000
> +++ b/mysql-test/suite/vcol/r/vcol_misc.result 2010-07-21 04:59:47 +0000
> @@ -87,3 +87,23 @@ a v
> 2002-02-15 00:00:00 0
> 2000-10-15 00:00:00 1
> DROP TABLE t1, t2;
> +CREATE TABLE t1 (p int, a double NOT NULL, v double AS (ROUND(a,p))
> VIRTUAL);
> +INSERT INTO t1 VALUES (0,1,0);
> +Warnings:
> +Warning 1645 The value specified for computed column 'v' in table 't1'
> ignored
> +INSERT INTO t1 VALUES (NULL,0,0);
> +Warnings:
> +Warning 1645 The value specified for computed column 'v' in table 't1'
> ignored
> +SELECT a, p, v, ROUND(a,p), ROUND(a,p+NULL) FROM t1;
> +a p v ROUND(a,p) ROUND(a,p+NULL)
> +1 0 1 1 NULL
> +0 NULL NULL NULL NULL
> +DROP TABLE t1;
> +CREATE TABLE t1 (p int, a double NOT NULL);
> +INSERT INTO t1(p,a) VALUES (0,1);
> +INSERT INTO t1(p,a) VALUES (NULL,0);
> +SELECT a, p, ROUND(a,p), ROUND(a,p+NULL) FROM t1;
> +a p ROUND(a,p) ROUND(a,p+NULL)
> +1 0 1 NULL
> +0 NULL NULL NULL
> +DROP TABLE t1;
>
> === modified file 'mysql-test/suite/vcol/t/vcol_misc.test'
> --- a/mysql-test/suite/vcol/t/vcol_misc.test 2010-07-17 19:58:08 +0000
> +++ b/mysql-test/suite/vcol/t/vcol_misc.test 2010-07-21 04:59:47 +0000
> @@ -87,3 +87,19 @@ INSERT INTO t2(a) VALUES ('2000-10-15');
> SELECT * FROM t2;
>
> DROP TABLE t1, t2;
> +
> +#
> +# Bug#607177: ROUND function in the expression for a virtual function
> +#
> +
> +CREATE TABLE t1 (p int, a double NOT NULL, v double AS (ROUND(a,p))
> VIRTUAL);
> +INSERT INTO t1 VALUES (0,1,0);
> +INSERT INTO t1 VALUES (NULL,0,0);
> +SELECT a, p, v, ROUND(a,p), ROUND(a,p+NULL) FROM t1;
> +DROP TABLE t1;
> +
> +CREATE TABLE t1 (p int, a double NOT NULL);
> +INSERT INTO t1(p,a) VALUES (0,1);
> +INSERT INTO t1(p,a) VALUES (NULL,0);
> +SELECT a, p, ROUND(a,p), ROUND(a,p+NULL) FROM t1;
> +DROP TABLE t1;
>
> === modified file 'sql/item_func.cc'
> --- a/sql/item_func.cc 2010-06-01 19:52:20 +0000
> +++ b/sql/item_func.cc 2010-07-21 04:59:47 +0000
> @@ -2040,10 +2040,12 @@ double Item_func_round::real_op()
> {
> double value= args[0]->val_real();
>
> - if (!(null_value= args[0]->null_value || args[1]->null_value))
> - return my_double_round(value, args[1]->val_int(),
> args[1]->unsigned_flag,
> - truncate);
> -
> + if (!(null_value= args[0]->null_value))
> + {
> + longlong dec= args[1]->val_int();
> + if (!(null_value= args[1]->null_value))
> + return my_double_round(value, dec, args[1]->unsigned_flag, truncate);
> + }
> return 0.0;
> }
>
>
> _______________________________________________
> commits mailing list
> commits@xxxxxxxxxxx
> https://lists.askmonty.org/cgi-bin/mailman/listinfo/commits
--
BR
Sergey
--
Sergey Petrunia, Software Developer
Monty Program AB, http://askmonty.org
Blog: http://s.petrunia.net/blog