List:Commits« Previous MessageNext Message »
From:<gshchepa Date:June 4 2007 9:17pm
Subject:bk commit into 5.0 tree (gshchepa:1.2506) BUG#28625
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of uchum. When uchum does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-06-05 02:17:29+05:00, gshchepa@stripped +10 -0
  Fixed bug #28625:
  DECIMAL column was used instead of BIGINT for the minimal possible
  BIGINT (-9223372036854775808).
  
  The parser didn't recognize negative numeric constants: it created
  Item_num subclass objects to keep _absolute_ values of given input
  data and then used Item_func_neg to change sign of those objects at
  the execution time.
  The absolute value (9223372036854775808) of the minimal possible
  BIGINT (-9223372036854775808) is greater than maximal signed positive
  BIGINT (9223372036854775807), so -9223372036854775808 was saved as
  DECIMAL value.
  
  The grammar has been transformed to the equivalent form distinguishing
  negative numeric constants from expressions with unary minus operator.
  After that modification items for negative constants contains negative
  numbers instead of absolute values, and there is no more need to call
  Item_func_neg methods for these numbers at execution time.
  DESCRIBE/SHOW CREATE statement now shows negative numbers in the form
  of "-10" instead of "-(10)" as column names for CREATE TABLE ... SELECT
  statement.
  
  

  mysql-test/r/bigint.result@stripped, 2007-06-05 01:50:31+05:00, gshchepa@stripped +7 -0
    Added test case for bug #28625.

  mysql-test/r/func_math.result@stripped, 2007-06-05 01:51:08+05:00, gshchepa@stripped +9 -9
    Updated test result for bug #28625.

  mysql-test/r/func_op.result@stripped, 2007-06-05 01:52:52+05:00, gshchepa@stripped +1 -1
    Updated test result for bug #28625.

  mysql-test/r/func_time.result@stripped, 2007-06-05 01:52:56+05:00, gshchepa@stripped +1 -1
    Updated test result for bug #28625.

  mysql-test/r/insert.result@stripped, 2007-06-05 01:52:58+05:00, gshchepa@stripped +1 -1
    Updated test result for bug #28625.

  mysql-test/r/type_newdecimal.result@stripped, 2007-06-05 01:52:59+05:00, gshchepa@stripped +1 -1
    Updated test result for bug #28625.

  mysql-test/t/bigint.test@stripped, 2007-06-05 01:50:13+05:00, gshchepa@stripped +10 -0
    Added test result for bug #28625.

  sql/sql_lex.cc@stripped, 2007-06-05 01:48:55+05:00, gshchepa@stripped +33 -30
    Fixed bug #28625.
    The st_lex::create_item_int method has been added to create Item_num
    subclass object with minimal capable storage for given text representation
    of the numeric value using information about the sign of that value from
    parser.

  sql/sql_lex.cc@stripped, 2007-06-05 01:19:23+05:00, gshchepa@stripped +98 -1
    Fixed bug #28625.
    The st_lex::create_item_int method has been added to create Item_num
    subclass object with minimal capable storage for given text representation
    of the numeric value using information about the sign of that value from
    parser.

  sql/sql_lex.h@stripped, 2007-06-05 01:12:53+05:00, gshchepa@stripped +4 -0
    Fixed bug #28625.
    The st_lex::unary_minus_tok field and the st_lex::create_item_num method
    have been added.

  sql/sql_yacc.yy@stripped, 2007-06-05 01:22:13+05:00, gshchepa@stripped +44 -30
    Fixed bug #28625.
    Grammar has been transformed to the equivalent grammar to distinguish
    negative number constants from negation operation of numeric expression.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	gshchepa
# Host:	gleb.loc
# Root:	/home/uchum/work/bk/5.0-opt-28625

--- 1.221/sql/sql_lex.cc	2007-05-11 18:26:09 +05:00
+++ 1.223/sql/sql_lex.cc	2007-06-05 01:48:55 +05:00
@@ -1695,6 +1695,105 @@ void st_lex::cleanup_lex_after_parse_err
   }
 }
 
+
+/*
+  Create Item_num object using text representation of the numeric value.
+
+  SYNOPSYS
+    st_lex::create_item_num()
+    token       token number (LONG_NUM etc., see MYSQLlex() and int_token())
+    num         text representation of absolute value of the number
+
+  NOTES
+    Only absolute value of the number is accessible from the
+    int_token function call at the MYSQLlex function, and there
+    is no way to distinguish unary minus token from substraction
+    operation. Because of look ahead parsing algorithm, this
+    information is available only after call to the int_token
+    function.
+    OTOH, binary representation of integers is not symmetrical:
+    abs(LONG_LONG_MIN) = LONG_LONG_MAX + 1, so there is no way to
+    save abs(LONG_LONG_MIN) in the Item_int::value.
+    The create_item_num function uses token number after the int_token
+    function and st_lex::unary_minus_tok value to specify "mininal"
+    Item_num subclass capable for saving of negative (or positive)
+    numeric value. This create_item_num function is for calling from
+    the parser after recognition of unary minus operator and
+    the NUM_literal nonterminal.
+
+  RETURN
+    Item_num object
+*/
+
+Item_num* st_lex::create_item_num(uint token, LEX_STRING *num)
+{
+  int error;
+  Item_num *item= NULL;
+  LEX_STRING tmp= *num;
+
+  DBUG_ENTER("st_lex::create_item_num");
+
+  if (unary_minus_tok)
+  {
+    unary_minus_tok= FALSE;
+    /*
+      Distinguish zero numbers, integer number and fixed/floating
+      point numbers for further transformation
+    */
+    bool zero= TRUE;      // TRUE <=> number is zero
+    bool dot= FALSE;      // TRUE <=> number has fractional part
+    bool exponent= FALSE; // TRUE <=> number has exponential part
+    for (uint i= 0; i < num->length; i++)
+    {
+      if (my_isdigit(thd->charset(), num->str[i]))
+      {
+        if (zero && !exponent && num->str[i] != '0')
+          zero= FALSE;
+      }
+      else
+      {
+        if (num->str[i] == 'e' || num->str[i] == 'E')
+          dot= exponent= TRUE;
+        else if (num->str[i] == '.')
+          dot= TRUE;
+      }
+    }
+    if (!zero)
+    {
+      tmp.length= num->length + 1;         // + 1 for '-'
+      tmp.str= thd->alloc(tmp.length + 1); // + 1 for '\0'
+      tmp.str[0]= '-';
+      memcpy(tmp.str + 1, num->str, num->length);
+      tmp.str[tmp.length]= '\0';
+
+      if (!dot)
+        token= int_token(tmp.str, tmp.length);
+    }
+  }
+
+  switch (token)
+  {
+  case NUM:
+  case LONG_NUM:
+    item= new Item_int(tmp.str,
+                       (longlong) my_strtoll10(tmp.str, NULL, &error),
+                       tmp.length);
+    break;
+  case ULONGLONG_NUM:
+    item= new Item_uint(tmp.str, tmp.length);
+    break;
+  case DECIMAL_NUM:
+    item= new Item_decimal(tmp.str, tmp.length, thd->charset());
+    break;
+  case FLOAT_NUM:
+    item= new Item_float(tmp.str, tmp.length);
+    break;
+  }
+  if (thd->net.report_error)
+    DBUG_RETURN(NULL);
+  DBUG_RETURN(item);
+}
+
 /*
   Initialize (or reset) Query_tables_list object.
 
@@ -1766,7 +1865,8 @@ void Query_tables_list::destroy_query_ta
 
 st_lex::st_lex()
   :result(0), yacc_yyss(0), yacc_yyvs(0),
-   sql_command(SQLCOM_END)
+   sql_command(SQLCOM_END),
+   unary_minus_tok(FALSE)
 {
   reset_query_tables_list(TRUE);
 }

--- 1.246/sql/sql_lex.h	2007-05-16 10:51:57 +05:00
+++ 1.247/sql/sql_lex.h	2007-06-05 01:12:53 +05:00
@@ -1162,6 +1162,8 @@ typedef struct st_lex : public Query_tab
 
   bool escape_used;
 
+  bool unary_minus_tok; // TRUE <=> NUM_literal is a negative value.
+
   st_lex();
 
   virtual ~st_lex()
@@ -1248,6 +1250,8 @@ typedef struct st_lex : public Query_tab
 
   void reset_n_backup_query_tables_list(Query_tables_list *backup);
   void restore_backup_query_tables_list(Query_tables_list *backup);
+
+  Item_num* create_item_num(uint token, LEX_STRING *str);
 } LEX;
 
 struct st_lex_local: public st_lex

--- 1.519/sql/sql_yacc.yy	2007-05-15 14:56:05 +05:00
+++ 1.520/sql/sql_yacc.yy	2007-06-05 01:22:13 +05:00
@@ -1075,6 +1075,7 @@ bool my_yyoverflow(short **a, YYSTYPE **
 	sp_opt_default
 	simple_ident_nospvar simple_ident_q
         field_or_var limit_option
+        non_numeric_literal non_numeric_simple_expr 
 
 %type <item_num>
 	NUM_literal
@@ -4658,7 +4659,8 @@ interval_expr:
         ;
 
 simple_expr:
-	simple_ident
+        non_numeric_simple_expr
+	| NUM_literal		{ $$ = $1; }
  	| simple_expr COLLATE_SYM ident_or_text %prec NEG
 	  {
 	    $$= new Item_func_set_collation($1,
@@ -4666,14 +4668,23 @@ simple_expr:
 							    $3.length,
                                                             YYTHD->charset()));
 	  }
-	| literal
+	| simple_expr OR_OR_SYM simple_expr
+	  { $$= new Item_func_concat($1, $3); }
+        ;
+
+non_numeric_simple_expr:
+	simple_ident
+        | non_numeric_literal
 	| param_marker
 	| variable
 	| sum_expr
-	| simple_expr OR_OR_SYM simple_expr
-	  { $$= new Item_func_concat($1, $3); }
 	| '+' simple_expr %prec NEG	{ $$= $2; }
-	| '-' simple_expr %prec NEG	{ $$= new Item_func_neg($2); }
+	| '-'
+          { YYTHD->lex->unary_minus_tok= TRUE; }
+          NUM_literal %prec NEG
+          { $$= $3; }
+	| '-' non_numeric_simple_expr %prec NEG
+          { $$= new Item_func_neg($2); }
 	| '~' simple_expr %prec NEG	{ $$= new Item_func_bit_neg($2); }
 	| not2 simple_expr %prec NEG	{ $$= negate_expression(YYTHD, $2); }
 	| '(' subselect ')'   
@@ -7584,18 +7595,20 @@ param_marker:
 
 signed_literal:
 	literal		{ $$ = $1; }
-	| '+' NUM_literal { $$ = $2; }
-	| '-' NUM_literal
-	  {
-	    $2->max_length++;
-	    $$= $2->neg();
-	  }
+	| '+' NUM_literal  %prec NEG { $$ = $2; }
+	| '-' 
+          { YYTHD->lex->unary_minus_tok= TRUE; }
+          NUM_literal  %prec NEG
+          { $$= $3; }
 	;
 
-
 literal:
+        non_numeric_literal
+        | NUM_literal	{ $$ = $1; }
+        ;
+
+non_numeric_literal:
 	text_literal	{ $$ =	$1; }
-	| NUM_literal	{ $$ = $1; }
 	| NULL_SYM
           {
             $$ = new Item_null();
@@ -7638,25 +7651,26 @@ literal:
 	| TIMESTAMP text_literal { $$ = $2; };
 
 NUM_literal:
-	NUM		{ int error; $$ = new Item_int($1.str, (longlong) my_strtoll10($1.str, NULL, &error), $1.length); }
-	| LONG_NUM	{ int error; $$ = new Item_int($1.str, (longlong) my_strtoll10($1.str, NULL, &error), $1.length); }
-	| ULONGLONG_NUM	{ $$ =	new Item_uint($1.str, $1.length); }
+	NUM
+          { if (!($$= YYTHD->lex->create_item_num(NUM, &$1)))
+              MYSQL_YYABORT;
+          }
+	| LONG_NUM
+          { if (!($$= YYTHD->lex->create_item_num(LONG_NUM, &$1)))
+              MYSQL_YYABORT;
+          }
+	| ULONGLONG_NUM
+          { if (!($$= YYTHD->lex->create_item_num(ULONGLONG_NUM, &$1)))
+              MYSQL_YYABORT;
+          }
         | DECIMAL_NUM
-	{
-           $$= new Item_decimal($1.str, $1.length, YYTHD->charset());
-	   if (YYTHD->net.report_error)
-	   {
-	     MYSQL_YYABORT;
-	   }
-	}
+          { if (!($$= YYTHD->lex->create_item_num(DECIMAL_NUM, &$1)))
+              MYSQL_YYABORT;
+          }
 	| FLOAT_NUM
-	{
-	   $$ =	new Item_float($1.str, $1.length);
-	   if (YYTHD->net.report_error)
-	   {
-	     MYSQL_YYABORT;
-	   }
-	}
+          { if (!($$= YYTHD->lex->create_item_num(FLOAT_NUM, &$1)))
+              MYSQL_YYABORT;
+          }
 	;
 
 /**********************************************************************

--- 1.48/mysql-test/r/type_newdecimal.result	2007-05-21 22:28:19 +05:00
+++ 1.49/mysql-test/r/type_newdecimal.result	2007-06-05 01:52:59 +05:00
@@ -176,7 +176,7 @@ Table	Create Table
 t1	CREATE TABLE `t1` (
   `round(15.4,-1)` decimal(3,0) NOT NULL default '0',
   `truncate(-5678.123451,-3)` decimal(4,0) NOT NULL default '0',
-  `abs(-1.1)` decimal(3,1) NOT NULL default '0.0',
+  `abs(-1.1)` decimal(2,1) NOT NULL default '0.0',
   `-(-1.1)` decimal(2,1) NOT NULL default '0.0'
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;

--- 1.35/mysql-test/r/bigint.result	2007-05-16 10:12:48 +05:00
+++ 1.36/mysql-test/r/bigint.result	2007-06-05 01:50:31 +05:00
@@ -362,3 +362,10 @@ cast(-19999999999999999999 as signed)
 -9223372036854775808
 Warnings:
 Error	1292	Truncated incorrect DECIMAL value: ''
+create table t1 select -9223372036854775808;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `-9223372036854775808` bigint(20) NOT NULL default '0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;

--- 1.36/mysql-test/r/func_math.result	2007-04-28 21:00:59 +05:00
+++ 1.37/mysql-test/r/func_math.result	2007-06-05 01:51:08 +05:00
@@ -6,7 +6,7 @@ explain extended select floor(5.5),floor
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
 Warnings:
-Note	1003	select floor(5.5) AS `floor(5.5)`,floor(-(5.5)) AS `floor(-5.5)`
+Note	1003	select floor(5.5) AS `floor(5.5)`,floor(-5.5) AS `floor(-5.5)`
 select ceiling(5.5),ceiling(-5.5);
 ceiling(5.5)	ceiling(-5.5)
 6	-5
@@ -14,7 +14,7 @@ explain extended select ceiling(5.5),cei
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
 Warnings:
-Note	1003	select ceiling(5.5) AS `ceiling(5.5)`,ceiling(-(5.5)) AS `ceiling(-5.5)`
+Note	1003	select ceiling(5.5) AS `ceiling(5.5)`,ceiling(-5.5) AS `ceiling(-5.5)`
 select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1);
 truncate(52.64,1)	truncate(52.64,2)	truncate(52.64,-1)	truncate(52.64,-2)	truncate(-52.64,1)	truncate(-52.64,-1)
 52.6	52.64	50	0	-52.6	-50
@@ -22,7 +22,7 @@ explain extended select truncate(52.64,1
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
 Warnings:
-Note	1003	select truncate(52.64,1) AS `truncate(52.64,1)`,truncate(52.64,2) AS `truncate(52.64,2)`,truncate(52.64,-(1)) AS `truncate(52.64,-1)`,truncate(52.64,-(2)) AS `truncate(52.64,-2)`,truncate(-(52.64),1) AS `truncate(-52.64,1)`,truncate(-(52.64),-(1)) AS `truncate(-52.64,-1)`
+Note	1003	select truncate(52.64,1) AS `truncate(52.64,1)`,truncate(52.64,2) AS `truncate(52.64,2)`,truncate(52.64,-1) AS `truncate(52.64,-1)`,truncate(52.64,-2) AS `truncate(52.64,-2)`,truncate(-52.64,1) AS `truncate(-52.64,1)`,truncate(-52.64,-1) AS `truncate(-52.64,-1)`
 select round(5.5),round(-5.5);
 round(5.5)	round(-5.5)
 6	-6
@@ -30,7 +30,7 @@ explain extended select round(5.5),round
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
 Warnings:
-Note	1003	select round(5.5,0) AS `round(5.5)`,round(-(5.5),0) AS `round(-5.5)`
+Note	1003	select round(5.5,0) AS `round(5.5)`,round(-5.5,0) AS `round(-5.5)`
 select round(5.64,1),round(5.64,2),round(5.64,-1),round(5.64,-2);
 round(5.64,1)	round(5.64,2)	round(5.64,-1)	round(5.64,-2)
 5.6	5.64	10	0
@@ -41,7 +41,7 @@ explain extended select abs(-10), sign(-
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
 Warnings:
-Note	1003	select abs(-(10)) AS `abs(-10)`,sign(-(5)) AS `sign(-5)`,sign(5) AS `sign(5)`,sign(0) AS `sign(0)`
+Note	1003	select abs(-10) AS `abs(-10)`,sign(-5) AS `sign(-5)`,sign(5) AS `sign(5)`,sign(0) AS `sign(0)`
 select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
 log(exp(10))	exp(log(sqrt(10))*2)	log(-1)	log(NULL)	log(1,1)	log(3,9)	log(-1,2)	log(NULL,2)
 10	10	NULL	NULL	NULL	2	NULL	NULL
@@ -49,7 +49,7 @@ explain extended select log(exp(10)),exp
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
 Warnings:
-Note	1003	select log(exp(10)) AS `log(exp(10))`,exp((log(sqrt(10)) * 2)) AS `exp(log(sqrt(10))*2)`,log(-(1)) AS `log(-1)`,log(NULL) AS `log(NULL)`,log(1,1) AS `log(1,1)`,log(3,9) AS `log(3,9)`,log(-(1),2) AS `log(-1,2)`,log(NULL,2) AS `log(NULL,2)`
+Note	1003	select log(exp(10)) AS `log(exp(10))`,exp((log(sqrt(10)) * 2)) AS `exp(log(sqrt(10))*2)`,log(-1) AS `log(-1)`,log(NULL) AS `log(NULL)`,log(1,1) AS `log(1,1)`,log(3,9) AS `log(3,9)`,log(-1,2) AS `log(-1,2)`,log(NULL,2) AS `log(NULL,2)`
 select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
 ln(exp(10))	exp(ln(sqrt(10))*2)	ln(-1)	ln(0)	ln(NULL)
 10	10	NULL	NULL	NULL
@@ -57,7 +57,7 @@ explain extended select ln(exp(10)),exp(
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
 Warnings:
-Note	1003	select ln(exp(10)) AS `ln(exp(10))`,exp((ln(sqrt(10)) * 2)) AS `exp(ln(sqrt(10))*2)`,ln(-(1)) AS `ln(-1)`,ln(0) AS `ln(0)`,ln(NULL) AS `ln(NULL)`
+Note	1003	select ln(exp(10)) AS `ln(exp(10))`,exp((ln(sqrt(10)) * 2)) AS `exp(ln(sqrt(10))*2)`,ln(-1) AS `ln(-1)`,ln(0) AS `ln(0)`,ln(NULL) AS `ln(NULL)`
 select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
 log2(8)	log2(15)	log2(-2)	log2(0)	log2(NULL)
 3	3.9068905956085	NULL	NULL	NULL
@@ -65,7 +65,7 @@ explain extended select log2(8),log2(15)
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
 Warnings:
-Note	1003	select log2(8) AS `log2(8)`,log2(15) AS `log2(15)`,log2(-(2)) AS `log2(-2)`,log2(0) AS `log2(0)`,log2(NULL) AS `log2(NULL)`
+Note	1003	select log2(8) AS `log2(8)`,log2(15) AS `log2(15)`,log2(-2) AS `log2(-2)`,log2(0) AS `log2(0)`,log2(NULL) AS `log2(NULL)`
 select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
 log10(100)	log10(18)	log10(-4)	log10(0)	log10(NULL)
 2	1.2552725051033	NULL	NULL	NULL
@@ -73,7 +73,7 @@ explain extended select log10(100),log10
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
 Warnings:
-Note	1003	select log10(100) AS `log10(100)`,log10(18) AS `log10(18)`,log10(-(4)) AS `log10(-4)`,log10(0) AS `log10(0)`,log10(NULL) AS `log10(NULL)`
+Note	1003	select log10(100) AS `log10(100)`,log10(18) AS `log10(18)`,log10(-4) AS `log10(-4)`,log10(0) AS `log10(0)`,log10(NULL) AS `log10(NULL)`
 select pow(10,log10(10)),power(2,4);
 pow(10,log10(10))	power(2,4)
 10	16

--- 1.11/mysql-test/r/func_op.result	2006-04-13 15:04:07 +05:00
+++ 1.12/mysql-test/r/func_op.result	2007-06-05 01:52:52 +05:00
@@ -5,7 +5,7 @@ explain extended select 1+1,1-1,1+1*2,8/
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
 Warnings:
-Note	1003	select (1 + 1) AS `1+1`,(1 - 1) AS `1-1`,(1 + (1 * 2)) AS `1+1*2`,(8 / 5) AS `8/5`,(8 % 5) AS `8%5`,(8 % 5) AS `mod(8,5)`,((8 % 5) | 0) AS `mod(8,5)|0`,(-((1 + 1)) * -(2)) AS `-(1+1)*-2`
+Note	1003	select (1 + 1) AS `1+1`,(1 - 1) AS `1-1`,(1 + (1 * 2)) AS `1+1*2`,(8 / 5) AS `8/5`,(8 % 5) AS `8%5`,(8 % 5) AS `mod(8,5)`,((8 % 5) | 0) AS `mod(8,5)|0`,(-((1 + 1)) * -2) AS `-(1+1)*-2`
 select 1 | (1+1),5 & 3,bit_count(7) ;
 1 | (1+1)	5 & 3	bit_count(7)
 3	1	3

--- 1.81/mysql-test/r/func_time.result	2007-03-06 21:50:42 +04:00
+++ 1.82/mysql-test/r/func_time.result	2007-06-05 01:52:56 +05:00
@@ -839,7 +839,7 @@ explain extended select period_add("9602
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
 Warnings:
-Note	1003	select period_add(_latin1'9602',-(12)) AS `period_add("9602",-12)`,period_diff(199505,_latin1'9404') AS `period_diff(199505,"9404")`,from_days(to_days(_latin1'960101')) AS `from_days(to_days("960101"))`,dayofmonth(_latin1'1997-01-02') AS `dayofmonth("1997-01-02")`,month(_latin1'1997-01-02') AS `month("1997-01-02")`,monthname(_latin1'1972-03-04') AS `monthname("1972-03-04")`,dayofyear(_latin1'0000-00-00') AS `dayofyear("0000-00-00")`,hour(_latin1'1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute(_latin1'23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week(_latin1'1998-03-03',0) AS `WEEK("1998-03-03")`,yearweek(_latin1'2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year(_latin1'98-02-03') AS `year("98-02-03")`,(weekday(curdate()) - weekday(now())) AS `weekday(curdate())-weekday(now())`,dayname(_latin1'1962-03-03') AS `dayname("1962-03-03")`,unix_timestamp() AS 
 `unix_timestamp()`,sec_to_time((time_to_sec(_latin1'0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format(_latin1'1997-01-02 03:04:05',_latin1'%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp(_latin1'1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,(_latin1'1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,(_latin1'1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from _latin1'1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INT
 ERVAL 1 SECOND)`
+Note	1003	select period_add(_latin1'9602',-12) AS `period_add("9602",-12)`,period_diff(199505,_latin1'9404') AS `period_diff(199505,"9404")`,from_days(to_days(_latin1'960101')) AS `from_days(to_days("960101"))`,dayofmonth(_latin1'1997-01-02') AS `dayofmonth("1997-01-02")`,month(_latin1'1997-01-02') AS `month("1997-01-02")`,monthname(_latin1'1972-03-04') AS `monthname("1972-03-04")`,dayofyear(_latin1'0000-00-00') AS `dayofyear("0000-00-00")`,hour(_latin1'1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute(_latin1'23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week(_latin1'1998-03-03',0) AS `WEEK("1998-03-03")`,yearweek(_latin1'2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year(_latin1'98-02-03') AS `year("98-02-03")`,(weekday(curdate()) - weekday(now())) AS `weekday(curdate())-weekday(now())`,dayname(_latin1'1962-03-03') AS `dayname("1962-03-03")`,unix_timestamp() AS `u
 nix_timestamp()`,sec_to_time((time_to_sec(_latin1'0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format(_latin1'1997-01-02 03:04:05',_latin1'%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp(_latin1'1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,(_latin1'1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,(_latin1'1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from _latin1'1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INTER
 VAL 1 SECOND)`
 SET @TMP=NOW();
 CREATE TABLE t1 (d DATETIME);
 INSERT INTO t1 VALUES (NOW());

--- 1.29/mysql-test/r/insert.result	2007-05-30 17:04:02 +05:00
+++ 1.30/mysql-test/r/insert.result	2007-06-05 01:52:58 +05:00
@@ -214,7 +214,7 @@ f_float_3_1_u	0.0
 set @value= 1e+1111111111;
 ERROR 22007: Illegal double '1e+1111111111' value found during parsing
 set @value= -1e+1111111111;
-ERROR 22007: Illegal double '1e+1111111111' value found during parsing
+ERROR 22007: Illegal double '-1e+1111111111' value found during parsing
 set @value= 1e+111;
 insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
 Warnings:

--- 1.30/mysql-test/t/bigint.test	2007-05-16 10:12:48 +05:00
+++ 1.31/mysql-test/t/bigint.test	2007-06-05 01:50:13 +05:00
@@ -294,3 +294,13 @@ drop table t1;
 
 select cast(19999999999999999999 as signed);
 select cast(-19999999999999999999 as signed);
+
+#
+# Bug #28625: -9223372036854775808 doesn't fit in BIGINT.
+#
+
+create table t1 select -9223372036854775808;
+show create table t1;
+drop table t1;
+
+
Thread
bk commit into 5.0 tree (gshchepa:1.2506) BUG#28625gshchepa4 Jun