Bug #137 <=> operator doesn't work as expected with ROW
Submitted: 9 Mar 2003 18:13 Modified: 10 Mar 2003 9:47
Reporter: jocelyn fournier (Silver Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1 OS:Any (all)
Assigned to: CPU Architecture:Any

[9 Mar 2003 18:13] jocelyn fournier
Description:
<=> operator returns always 1 when ROW is used.

How to repeat:

mysql> SELECT ROW(2,10) <=> ROW(3,4);
+------------------------+
| ROW(2,10) <=> ROW(3,4) |
+------------------------+
|                      1 |
+------------------------+
1 row in set (0.00 sec)

=> should return 0

mysql> SELECT ROW(NULL,10) <=> (ROW(3,NULL));
+--------------------------------+
| ROW(NULL,10) <=> (ROW(3,NULL)) |
+--------------------------------+
|                              1 |
+--------------------------------+
1 row in set (0.00 sec)

=> should return NULL
[10 Mar 2003 9:47] Sinisa Milivojevic
==== sql/item_cmpfunc.cc 1.75 vs edited =====
*** /tmp/item_cmpfunc.cc-1.75-8523      Fri Mar  7 11:39:24 2003
--- edited/sql/item_cmpfunc.cc  Mon Mar 10 19:26:07 2003
***************
*** 266,273 ****
    uint n= (*a)->cols();
    for (uint i= 0; i<n; i++)
    {
!     if ((res= comparators[i].compare()))
!       return 1;
    }
    return 1;
  }
--- 266,273 ----
    uint n= (*a)->cols();
    for (uint i= 0; i<n; i++)
    {
!     if ((res= !comparators[i].compare()))
!       return 0;
    }
    return 1;
  }
***************
*** 352,358 ****
  {
    Item_bool_func2::fix_length_and_dec();
    maybe_null=null_value=0;
-   set_cmp_func();
  }
  
  longlong Item_func_equal::val_int()
--- 352,357 ----

Additional note:
SELECT ROW(NULL,10) <=> (ROW(3,NULL))

should be 0 and not NULL.
<=> never returns NULL, only 0 and 1.