Hi!

>>>>> "Benjamin" == Benjamin Pflugmann <[EMAIL PROTECTED]> writes:

<cut>

>> In order to get predictable result you need to use:
>> 
>> select concat_ws('.',oct1,oct2,oct3,oct4) as IP, count(*) as c from
>> ips group by IP [having c > 1];

Benjamin> I have tested this and it doesn't fix the problem.

Benjamin> What follows is a complete test case and the output from running it on
Benjamin> my system. Please note, that it has the additional (but not necessary)
Benjamin> property that each group contains only one row, so there can not be
Benjamin> any ambiguity which values will be used.

Benjamin> SELECT VERSION();
Benjamin> DROP TABLE IF EXISTS group_by_bug;
Benjamin> CREATE TABLE group_by_bug ( number INT NOT NULL, alpha CHAR(6) NOT NULL );
Benjamin> INSERT INTO group_by_bug VALUES (1413006,'idlfmv'),
Benjamin> (1413065,'smpsfz'),(1413127,'sljrhx'),(1413304,'qerfnd');

Benjamin> /* like the original exmaple */
Benjamin> SELECT number, alpha, CONCAT_WS('<---->',number,alpha) AS new
Benjamin> FROM group_by_bug GROUP BY number;

<cut>

Thanks for the clear example.

Here is a patch for this (it will be in 3.23.51 and 4.0.2):


===== sql/item_strfunc.cc 1.26 vs edited =====
*** /tmp/item_strfunc.cc-1.26-31001     Tue Apr  2 17:42:01 2002
--- edited/sql/item_strfunc.cc  Fri May 17 10:33:33 2002
***************
*** 313,319 ****
  
  void Item_func_concat_ws::fix_length_and_dec()
  {
!   max_length=0;
    for (uint i=0 ; i < arg_count ; i++)
      max_length+=args[i]->max_length;
    if (max_length > MAX_BLOB_WIDTH)
--- 313,319 ----
  
  void Item_func_concat_ws::fix_length_and_dec()
  {
!   max_length=separator->max_length*(arg_count-1);
    for (uint i=0 ; i < arg_count ; i++)
      max_length+=args[i]->max_length;
    if (max_length > MAX_BLOB_WIDTH)


Regards,
Monty

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to