Commit 61f1e9a3 authored by unknown's avatar unknown
Browse files

Merge bk-internal.mysql.com:/home/bk/mysql-5.0

into mysql.com:/home/my/mysql-5.0


sql/handler.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
parents 87110734 802c41e0
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -1396,10 +1396,9 @@ static uint getTableStructure(char *table, char* db)
      /* Get MySQL specific create options */
      if (create_options)
      {
	char show_name_buff[FN_REFLEN];
	char show_name_buff[NAME_LEN*2+2+24];

	/* Check memory for quote_for_like() */
	DBUG_ASSERT(2*sizeof(table) < sizeof(show_name_buff));
        my_snprintf(buff, sizeof(buff), "show table status like %s",
		    quote_for_like(table, show_name_buff));

+45 −0
Original line number Diff line number Diff line
@@ -378,6 +378,51 @@ a sum(b)
2	6
4	4
NULL	14
SELECT b, a, sum(b) FROM t1 GROUP BY a,b WITH ROLLUP;
b	a	sum(b)
4	1	4
NULL	1	4
1	2	2
2	2	4
NULL	2	6
1	4	4
NULL	4	4
NULL	NULL	14
SELECT DISTINCT b,a, sum(b) FROM t1 GROUP BY a,b WITH ROLLUP;
b	a	sum(b)
4	1	4
NULL	1	4
1	2	2
2	2	4
NULL	2	6
1	4	4
NULL	4	4
NULL	NULL	14
ALTER TABLE t1 ADD COLUMN c INT;
SELECT a,b,sum(c) FROM t1 GROUP BY a,b,c WITH ROLLUP;
a	b	sum(c)
1	4	NULL
1	4	NULL
1	NULL	NULL
2	1	NULL
2	1	NULL
2	2	NULL
2	2	NULL
2	NULL	NULL
4	1	NULL
4	1	NULL
4	NULL	NULL
NULL	NULL	NULL
SELECT distinct a,b,sum(c) FROM t1 GROUP BY a,b,c WITH ROLLUP;
a	b	sum(c)
1	4	NULL
1	NULL	NULL
2	1	NULL
2	2	NULL
2	NULL	NULL
4	1	NULL
4	NULL	NULL
NULL	NULL	NULL
DROP TABLE t1;
CREATE TABLE t1 (a int, b int);
INSERT INTO t1 VALUES
+7 −0
Original line number Diff line number Diff line
@@ -153,6 +153,13 @@ SELECT DISTINCT SUM(b), COUNT(DISTINCT b), COUNT(*) FROM t1
SELECT a, sum(b) FROM t1 GROUP BY a,b WITH ROLLUP;
SELECT DISTINCT a, sum(b) FROM t1 GROUP BY a,b WITH ROLLUP;

SELECT b, a, sum(b) FROM t1 GROUP BY a,b WITH ROLLUP;
SELECT DISTINCT b,a, sum(b) FROM t1 GROUP BY a,b WITH ROLLUP;

ALTER TABLE t1 ADD COLUMN c INT;
SELECT a,b,sum(c) FROM t1 GROUP BY a,b,c WITH ROLLUP;
SELECT distinct a,b,sum(c) FROM t1 GROUP BY a,b,c WITH ROLLUP;

DROP TABLE t1;

#
+9 −5
Original line number Diff line number Diff line
@@ -767,14 +767,13 @@ static char* xid_to_str(char *buf, XID *xid)
  for (i=0; i < xid->gtrid_length+xid->bqual_length; i++)
  {
    uchar c=(uchar)xid->data[i];
    bool is_next_dig;
    /* is_next_dig is set if next character is a number */
    bool is_next_dig= FALSE;
    if (i < XIDDATASIZE)
    {
      char ch= xid->data[i+1];
      is_next_dig=(c >= '0' && c <='9');
      is_next_dig= (ch >= '0' && ch <='9');
    }
    else
      is_next_dig=FALSE;
    if (i == xid->gtrid_length)
    {
      *s++='\'';
@@ -787,6 +786,11 @@ static char* xid_to_str(char *buf, XID *xid)
    if (c < 32 || c > 126)
    {
      *s++='\\';
      /*
        If next character is a number, write current character with
        3 octal numbers to ensure that the next number is not seen
        as part of the octal number
      */
      if (c > 077 || is_next_dig)
        *s++=_dig_vec_lower[c >> 6];
      if (c > 007 || is_next_dig)
+2 −12
Original line number Diff line number Diff line
@@ -586,18 +586,8 @@ Item *Item_string::safe_charset_converter(CHARSET_INFO *tocs)
    return NULL;
  }
  conv->str_value.copy();
  /* 
    The above line executes str_value.realloc() internally,
    which alligns Alloced_length using ALLIGN_SIZE.
    In the case of Item_string::str_value we don't want
    Alloced_length to be longer than str_length.
    Otherwise, some functions like Item_func_concat::val_str()
    try to reuse str_value as a buffer for concatenation result
    for optimization purposes, so our string constant become
    corrupted. See bug#8785 for more details.
    Let's shrink Alloced_length to str_length to avoid this problem.
  */
  conv->str_value.shrink_to_length();
  /* Ensure that no one is going to change the result string */
  conv->str_value.mark_as_const();
  return conv;
}

Loading