Bug #61540 Contribution to Bug #60176 max(if(1,unsigned,signed)) inconsistent

Submitted: 16 Jun 2011 16:08 Modified: 21 Jun 2011 10:50
Reporter: Yuli Vasiliev Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1 OS:Any
Assigned to: CPU Architecture:Any
Tags: Contribution

[16 Jun 2011 16:08] Yuli Vasiliev
Description:
The problem is, in case of the if function, that the unsigned flag is determined incorrectly. To solve the problem, the unsighed_flag variable in the Item_func_if::fix_length_and_dec() function (Item_cmpfunc.cc) must be determined as the result of a logical disjunction performed on the unsigned flags of the arguments:

  unsigned_flag=args[1]->unsigned_flag || args[2]->unsigned_flag;

rather than a logical conjunction, as we have it now: 

  unsigned_flag=args[1]->unsigned_flag && args[2]->unsigned_flag;

How to repeat:

=== modified file 'sql/item_cmpfunc.cc'
--- item_cmpfunc.cc     2011-03-31 18:59:11 +0000
+++ item_cmpfunc.cc     2011-06-16 10:15:03 +0000
@@ -0,0 +1,17 @@ void
Item_func_if::fix_length_and_dec()
{
  maybe_null=args[1]->maybe_null || args[2]->maybe_null;
  decimals= max(args[1]->decimals, args[2]->decimals);
- unsigned_flag=args[1]->unsigned_flag && args[2]->unsigned_flag;
+ unsigned_flag=args[1]->unsigned_flag || args[2]->unsigned_flag;

}
[21 Jun 2011 10:53] Valeriy Kravchuk
Let's say it is a duplicate of bug #60176. Read http://forge.mysql.com/wiki/Sun_Contributor_Agreement about the details of OCA.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.