List:Commits« Previous MessageNext Message »
From:Chad MILLER Date:April 9 2008 1:14pm
Subject:bk commit into 5.0 tree (cmiller:1.2503) BUG#15776
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of cmiller. When cmiller 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, 2008-04-09 09:14:20-04:00, cmiller@stripped +3 -0
  Follow-up to Bug#15776, test failures on 64-bit linux.
  
  Make maximum blob size to be 2**32-1, regardless of word size.
  
  Fix failure of timestamp with size of 2**31-1.  The method of
  rounding up to the nearest even number would overflow.

  mysql-test/r/type_blob.result@stripped, 2008-04-09 09:14:19-04:00, cmiller@stripped +39 -35
    2**32-1 is not a special case for timestamp.
    
    Test 2**32-1 and 2**64 as the reliable test points for both 32-
    and 64-bit machines.  I'd like to test 2**32, but that would make 
    tests that vary between architectures.
    
    I'd like to generalize the tests by pulling the max blob size from
    the server, and then "eval"ing N-1, N, and N+1 instead of all these
    literal numbers, but I have not found a way to get UINT_MAX.

  mysql-test/t/type_blob.test@stripped, 2008-04-09 09:14:19-04:00, cmiller@stripped +46 -14
    2**32-1 is not a special case for timestamp.
    
    Test 2**32-1 and 2**64 as the reliable test points for both 32-
    and 64-bit machines.  I'd like to test 2**32, but that would make 
    tests that vary between architectures.
    
    I'd like to generalize the tests by pulling the max blob size from
    the server, and then "eval"ing N-1, N, and N+1 instead of all these
    literal numbers, but I have not found a way to get UINT_MAX.

  sql/field.cc@stripped, 2008-04-09 09:14:19-04:00, cmiller@stripped +14 -5
    Fix a bug where the round-to-even code for TIMESTAMP fields
    failed where the size would overflow the size to zero and then
    fail.
    
    Also, since we silently truncate the size of TIMESTAMP fields, set
    the maximum size we report is allowable to be the largest parsable
    number.

diff -Nrup a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
--- a/mysql-test/r/type_blob.result	2008-04-01 12:26:10 -04:00
+++ b/mysql-test/r/type_blob.result	2008-04-09 09:14:19 -04:00
@@ -818,8 +818,8 @@ create table b15776 (data blob(429496729
 drop table b15776;
 create table b15776 (data blob(4294967295));
 drop table b15776;
-create table b15776 (data blob(4294967296));
-ERROR 42000: Display width out of range for column 'data' (max = 4294967295)
+create table b15776 (data blob(18446744073709551616));
+ERROR 42000: Display width out of range for column 'data' (max = UINT_MAX)
 CREATE TABLE b15776 (a blob(2147483647), b blob(2147483648), c blob(4294967295), a1 text(2147483647), b1 text(2147483648), c1 text(4294967295) );
 show columns from b15776;
 Field	Type	Null	Key	Default	Extra
@@ -830,14 +830,14 @@ a1	longtext	YES		NULL	
 b1	longtext	YES		NULL	
 c1	longtext	YES		NULL	
 drop table b15776;
-CREATE TABLE b15776 (a blob(4294967296));
-ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
-CREATE TABLE b15776 (a text(4294967296));
-ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
+CREATE TABLE b15776 (a blob(18446744073709551616));
+ERROR 42000: Display width out of range for column 'a' (max = UINT_MAX)
+CREATE TABLE b15776 (a text(18446744073709551616));
+ERROR 42000: Display width out of range for column 'a' (max = UINT_MAX)
 CREATE TABLE b15776 (a blob(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
-ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
+ERROR 42000: Display width out of range for column 'a' (max = UINT_MAX)
 CREATE TABLE b15776 (a text(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
-ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
+ERROR 42000: Display width out of range for column 'a' (max = UINT_MAX)
 CREATE TABLE b15776 (a int(0));
 INSERT INTO b15776 values (NULL), (1), (42), (654);
 SELECT * from b15776 ORDER BY a;
@@ -861,16 +861,16 @@ CREATE TABLE b15776 (a char(2147483648))
 ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead
 CREATE TABLE b15776 (a char(4294967295));
 ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead
-CREATE TABLE b15776 (a char(4294967296));
-ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
+CREATE TABLE b15776 (a char(18446744073709551616));
+ERROR 42000: Display width out of range for column 'a' (max = UINT_MAX)
 CREATE TABLE b15776 (a year(4294967295));
 INSERT INTO b15776 VALUES (42);
 SELECT * FROM b15776;
 a
 2042
 DROP TABLE b15776;
-CREATE TABLE b15776 (a year(4294967296));
-ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
+CREATE TABLE b15776 (a year(18446744073709551616));
+ERROR 42000: Display width out of range for column 'a' (max = UINT_MAX)
 CREATE TABLE b15776 (a year(0));
 DROP TABLE b15776;
 CREATE TABLE b15776 (a year(-2));
@@ -880,19 +880,23 @@ Warnings:
 Warning	1287	'TIMESTAMP(4294967294)' is deprecated; use 'TIMESTAMP' instead
 DROP TABLE b15776;
 CREATE TABLE b15776 (a timestamp(4294967295));
-ERROR 42000: Display width out of range for column 'a' (max = 255)
-CREATE TABLE b15776 (a timestamp(4294967296));
-ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
+Warnings:
+Warning	1287	'TIMESTAMP(4294967295)' is deprecated; use 'TIMESTAMP' instead
+DROP TABLE b15776;
+CREATE TABLE b15776 (a timestamp(18446744073709551616));
+ERROR 42000: Display width out of range for column 'a' (max = UINT_MAX)
+CREATE TABLE b15776 (a timestamp(-1));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1))' at line 1
 CREATE TABLE b15776 (a timestamp(-2));
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-2))' at line 1
 CREATE TABLE b15776 (a int(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
-ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
+ERROR 42000: Display width out of range for column 'a' (max = UINT_MAX)
 CREATE TABLE b15776 (a char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
-ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
+ERROR 42000: Display width out of range for column 'a' (max = UINT_MAX)
 CREATE TABLE b15776 (a year(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
-ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
+ERROR 42000: Display width out of range for column 'a' (max = UINT_MAX)
 CREATE TABLE b15776 (a timestamp(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
-ERROR 42000: Display width out of range for column 'a' (max = 4294967295)
+ERROR 42000: Display width out of range for column 'a' (max = UINT_MAX)
 CREATE TABLE b15776 select cast(null as char(4294967295));
 show columns from b15776;
 Field	Type	Null	Key	Default	Extra
@@ -917,12 +921,12 @@ id	select_type	table	type	possible_keys	
 explain select cast(1 as binary(4294967295));
 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
-explain select cast(1 as char(4294967296));
-ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
-explain select cast(1 as nchar(4294967296));
-ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
-explain select cast(1 as binary(4294967296));
-ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
+explain select cast(1 as char(18446744073709551616));
+ERROR 42000: Display width out of range for column 'cast as char' (max = UINT_MAX)
+explain select cast(1 as nchar(18446744073709551616));
+ERROR 42000: Display width out of range for column 'cast as char' (max = UINT_MAX)
+explain select cast(1 as binary(18446744073709551616));
+ERROR 42000: Display width out of range for column 'cast as char' (max = UINT_MAX)
 explain select cast(1 as decimal(-1));
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1))' at line 1
 explain select cast(1 as decimal(64, 30));
@@ -930,29 +934,29 @@ id	select_type	table	type	possible_keys	
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
 explain select cast(1 as decimal(64, 999999999999999999999999999999));
 Got one of the listed errors
-explain select cast(1 as decimal(4294967296));
+explain select cast(1 as decimal(18446744073709551616));
 Got one of the listed errors
 explain select cast(1 as decimal(999999999999999999999999999999999999));
 Got one of the listed errors
 explain select convert(1, char(4294967295));
 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
-explain select convert(1, char(4294967296));
-ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
+explain select convert(1, char(18446744073709551616));
+ERROR 42000: Display width out of range for column 'cast as char' (max = UINT_MAX)
 explain select convert(1, char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
-ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
+ERROR 42000: Display width out of range for column 'cast as char' (max = UINT_MAX)
 explain select convert(1, nchar(4294967295));
 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
-explain select convert(1, nchar(4294967296));
-ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
+explain select convert(1, nchar(18446744073709551616));
+ERROR 42000: Display width out of range for column 'cast as char' (max = UINT_MAX)
 explain select convert(1, nchar(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
-ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
+ERROR 42000: Display width out of range for column 'cast as char' (max = UINT_MAX)
 explain select convert(1, binary(4294967295));
 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
-explain select convert(1, binary(4294967296));
-ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
+explain select convert(1, binary(18446744073709551616));
+ERROR 42000: Display width out of range for column 'cast as char' (max = UINT_MAX)
 explain select convert(1, binary(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
-ERROR 42000: Display width out of range for column 'cast as char' (max = 4294967295)
+ERROR 42000: Display width out of range for column 'cast as char' (max = UINT_MAX)
 End of 5.0 tests
diff -Nrup a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test
--- a/mysql-test/t/type_blob.test	2008-03-26 14:52:08 -04:00
+++ b/mysql-test/t/type_blob.test	2008-04-09 09:14:19 -04:00
@@ -447,6 +447,12 @@ set @@sql_mode='';
 # If size is too small:
 #   raise ER_PARSE_ERROR
 # raise ER_TOO_BIG_DISPLAYWIDTH
+#
+# We make a curious skip over a lot of numberspace here, so as to make tests
+# that work the same way on 32- and 64-bit machines.  We test that 2**32-1
+# works and that 2**64 fails, but none in bewteen.  When we add 256-bit
+# machines to our build pool, we'll need to split these into architecture-
+# specific tests.
 
 # BLOB and TEXT types
 --disable_warnings
@@ -462,19 +468,24 @@ create table b15776 (data blob(429496729
 drop table b15776;
 create table b15776 (data blob(4294967295));
 drop table b15776;
+--replace_regex /= 4294967295/= UINT_MAX/  /= 18446744073709551615/= UINT_MAX/
 --error ER_TOO_BIG_DISPLAYWIDTH
-create table b15776 (data blob(4294967296));
+create table b15776 (data blob(18446744073709551616));
 
 CREATE TABLE b15776 (a blob(2147483647), b blob(2147483648), c blob(4294967295), a1 text(2147483647), b1 text(2147483648), c1 text(4294967295) );
 show columns from b15776;
 drop table b15776;
 
+--replace_regex /= 4294967295/= UINT_MAX/  /= 18446744073709551615/= UINT_MAX/
 --error ER_TOO_BIG_DISPLAYWIDTH
-CREATE TABLE b15776 (a blob(4294967296));
+CREATE TABLE b15776 (a blob(18446744073709551616));
+--replace_regex /= 4294967295/= UINT_MAX/  /= 18446744073709551615/= UINT_MAX/
 --error ER_TOO_BIG_DISPLAYWIDTH
-CREATE TABLE b15776 (a text(4294967296));
+CREATE TABLE b15776 (a text(18446744073709551616));
+--replace_regex /= 4294967295/= UINT_MAX/  /= 18446744073709551615/= UINT_MAX/
 --error ER_TOO_BIG_DISPLAYWIDTH
 CREATE TABLE b15776 (a blob(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
+--replace_regex /= 4294967295/= UINT_MAX/  /= 18446744073709551615/= UINT_MAX/
 --error ER_TOO_BIG_DISPLAYWIDTH
 CREATE TABLE b15776 (a text(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
 
@@ -506,8 +517,9 @@ CREATE TABLE b15776 (a char(2147483648))
 --error ER_TOO_BIG_FIELDLENGTH
 CREATE TABLE b15776 (a char(4294967295));
 # Even BLOB won't hold
+--replace_regex /= 4294967295/= UINT_MAX/  /= 18446744073709551615/= UINT_MAX/
 --error ER_TOO_BIG_DISPLAYWIDTH
-CREATE TABLE b15776 (a char(4294967296));
+CREATE TABLE b15776 (a char(18446744073709551616));
 
 
 # Other numeric-ish types
@@ -518,8 +530,9 @@ CREATE TABLE b15776 (a year(4294967295))
 INSERT INTO b15776 VALUES (42);
 SELECT * FROM b15776;
 DROP TABLE b15776;
+--replace_regex /= 4294967295/= UINT_MAX/  /= 18446744073709551615/= UINT_MAX/
 --error ER_TOO_BIG_DISPLAYWIDTH
-CREATE TABLE b15776 (a year(4294967296));
+CREATE TABLE b15776 (a year(18446744073709551616));
 CREATE TABLE b15776 (a year(0));  # 0 is special case, means default size
 DROP TABLE b15776;
 --error ER_PARSE_ERROR
@@ -528,22 +541,29 @@ CREATE TABLE b15776 (a year(-2));
 ## For timestamp, we silently rewrite widths to 14 or 19.
 CREATE TABLE b15776 (a timestamp(4294967294));
 DROP TABLE b15776;
---error ER_TOO_BIG_DISPLAYWIDTH
 CREATE TABLE b15776 (a timestamp(4294967295));
+DROP TABLE b15776;
+--replace_regex /= 4294967295/= UINT_MAX/  /= 18446744073709551615/= UINT_MAX/
 --error ER_TOO_BIG_DISPLAYWIDTH
-CREATE TABLE b15776 (a timestamp(4294967296));
+CREATE TABLE b15776 (a timestamp(18446744073709551616));
+--error ER_PARSE_ERROR
+CREATE TABLE b15776 (a timestamp(-1));
 --error ER_PARSE_ERROR
 CREATE TABLE b15776 (a timestamp(-2));
 
 
 # We've already tested the case, but this should visually show that 
 # widths that are too large to be interpreted cause DISPLAYWIDTH errors.
+--replace_regex /= 4294967295/= UINT_MAX/  /= 18446744073709551615/= UINT_MAX/
 --error ER_TOO_BIG_DISPLAYWIDTH
 CREATE TABLE b15776 (a int(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
+--replace_regex /= 4294967295/= UINT_MAX/  /= 18446744073709551615/= UINT_MAX/
 --error ER_TOO_BIG_DISPLAYWIDTH
 CREATE TABLE b15776 (a char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
+--replace_regex /= 4294967295/= UINT_MAX/  /= 18446744073709551615/= UINT_MAX/
 --error ER_TOO_BIG_DISPLAYWIDTH
 CREATE TABLE b15776 (a year(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
+--replace_regex /= 4294967295/= UINT_MAX/  /= 18446744073709551615/= UINT_MAX/
 --error ER_TOO_BIG_DISPLAYWIDTH
 CREATE TABLE b15776 (a timestamp(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
 
@@ -562,12 +582,15 @@ explain select cast(1 as char(4294967295
 explain select cast(1 as nchar(4294967295));
 explain select cast(1 as binary(4294967295));
 
+--replace_regex /= 4294967295/= UINT_MAX/  /= 18446744073709551615/= UINT_MAX/
 --error ER_TOO_BIG_DISPLAYWIDTH
-explain select cast(1 as char(4294967296));
+explain select cast(1 as char(18446744073709551616));
+--replace_regex /= 4294967295/= UINT_MAX/  /= 18446744073709551615/= UINT_MAX/
 --error ER_TOO_BIG_DISPLAYWIDTH
-explain select cast(1 as nchar(4294967296));
+explain select cast(1 as nchar(18446744073709551616));
+--replace_regex /= 4294967295/= UINT_MAX/  /= 18446744073709551615/= UINT_MAX/
 --error ER_TOO_BIG_DISPLAYWIDTH
-explain select cast(1 as binary(4294967296));
+explain select cast(1 as binary(18446744073709551616));
 
 --error ER_PARSE_ERROR
 explain select cast(1 as decimal(-1));
@@ -577,26 +600,35 @@ explain select cast(1 as decimal(64, 30)
 # 4294967295 and still reject it because it's greater than 64 or 30, 
 # but that's not a high priority and the parser needn't worry about 
 # such a weird case.
+--replace_regex /= 4294967295/= UINT_MAX/  /= 18446744073709551615/= UINT_MAX/
 --error ER_TOO_BIG_SCALE,ER_PARSE_ERROR
 explain select cast(1 as decimal(64, 999999999999999999999999999999));
+--replace_regex /= 4294967295/= UINT_MAX/  /= 18446744073709551615/= UINT_MAX/
 --error ER_TOO_BIG_PRECISION,ER_PARSE_ERROR
-explain select cast(1 as decimal(4294967296));
+explain select cast(1 as decimal(18446744073709551616));
+--replace_regex /= 4294967295/= UINT_MAX/  /= 18446744073709551615/= UINT_MAX/
 --error ER_TOO_BIG_PRECISION,ER_PARSE_ERROR
 explain select cast(1 as decimal(999999999999999999999999999999999999));
 
 explain select convert(1, char(4294967295));
+--replace_regex /= 4294967295/= UINT_MAX/  /= 18446744073709551615/= UINT_MAX/
 --error ER_TOO_BIG_DISPLAYWIDTH
-explain select convert(1, char(4294967296));
+explain select convert(1, char(18446744073709551616));
+--replace_regex /= 4294967295/= UINT_MAX/  /= 18446744073709551615/= UINT_MAX/
 --error ER_TOO_BIG_DISPLAYWIDTH
 explain select convert(1, char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
 explain select convert(1, nchar(4294967295));
+--replace_regex /= 4294967295/= UINT_MAX/  /= 18446744073709551615/= UINT_MAX/
 --error ER_TOO_BIG_DISPLAYWIDTH
-explain select convert(1, nchar(4294967296));
+explain select convert(1, nchar(18446744073709551616));
+--replace_regex /= 4294967295/= UINT_MAX/  /= 18446744073709551615/= UINT_MAX/
 --error ER_TOO_BIG_DISPLAYWIDTH
 explain select convert(1, nchar(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
 explain select convert(1, binary(4294967295));
+--replace_regex /= 4294967295/= UINT_MAX/  /= 18446744073709551615/= UINT_MAX/
 --error ER_TOO_BIG_DISPLAYWIDTH
-explain select convert(1, binary(4294967296));
+explain select convert(1, binary(18446744073709551616));
+--replace_regex /= 4294967295/= UINT_MAX/  /= 18446744073709551615/= UINT_MAX/
 --error ER_TOO_BIG_DISPLAYWIDTH
 explain select convert(1, binary(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
 
diff -Nrup a/sql/field.cc b/sql/field.cc
--- a/sql/field.cc	2007-08-31 15:24:41 -04:00
+++ b/sql/field.cc	2008-04-09 09:14:19 -04:00
@@ -8556,7 +8556,7 @@ bool create_field::init(THD *thd, char *
     }
     break;
   case FIELD_TYPE_TIMESTAMP:
-    if (!fld_length)
+    if (fld_length == NULL)
     {
       /* Compressed date YYYYMMDDHHMMSS */
       length= MAX_DATETIME_COMPRESSED_WIDTH;
@@ -8565,12 +8565,21 @@ bool create_field::init(THD *thd, char *
     {
       /*
         We support only even TIMESTAMP lengths less or equal than 14
-        and 19 as length of 4.1 compatible representation.
+        and 19 as length of 4.1 compatible representation.  Silently 
+        shrink it to MAX_DATETIME_COMPRESSED_WIDTH.
       */
-      length= ((length+1)/2)*2; /* purecov: inspected */
-      length= min(length, MAX_DATETIME_COMPRESSED_WIDTH); /* purecov: inspected */
+	  DBUG_ASSERT(MAX_DATETIME_COMPRESSED_WIDTH < UINT_MAX);
+      if (length != UINT_MAX)  /* avoid overflow; is safe because of min() */
+        length= ((length+1)/2)*2;
+      length= min(length, MAX_DATETIME_COMPRESSED_WIDTH);
     }
     flags|= ZEROFILL_FLAG | UNSIGNED_FLAG;
+    /*
+      Since we silently rewrite down to MAX_DATETIME_COMPRESSED_WIDTH bytes,
+      the parser should not raise errors unless bizzarely large. 
+     */
+    max_field_charlength= UINT_MAX;
+
     if (fld_default_value)
     {
       /* Grammar allows only NOW() value for ON UPDATE clause */
@@ -8677,7 +8686,7 @@ bool create_field::init(THD *thd, char *
       ((length > max_field_charlength && fld_type != FIELD_TYPE_SET &&
         fld_type != FIELD_TYPE_ENUM &&
         (fld_type != MYSQL_TYPE_VARCHAR || fld_default_value)) ||
-       (!length &&
+       ((length == 0) &&
         fld_type != MYSQL_TYPE_STRING &&
         fld_type != MYSQL_TYPE_VARCHAR && fld_type != FIELD_TYPE_GEOMETRY)))
   {
Thread
bk commit into 5.0 tree (cmiller:1.2503) BUG#15776Chad MILLER9 Apr