List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:June 23 2010 4:25pm
Subject:bzr commit into mysql-5.1-bugteam branch (Georgi.Kodinov:3438) Bug#53814
View as plain text  
#At file:///home/kgeorge/mysql/work/B53814-5.1-bugteam/ based on revid:sergey.glukhov@stripped

 3438 Georgi Kodinov	2010-06-23
      Bug #53814: NUMERIC_PRECISION for unsigned bigint field is 19, 
      should be 20
      
      Fixed the numeric precision of the unsigned BIGINT column to 
      be 20 instead of 19.

    modified:
      mysql-test/r/information_schema.result
      mysql-test/t/information_schema.test
      sql/sql_show.cc
=== modified file 'mysql-test/r/information_schema.result'
--- a/mysql-test/r/information_schema.result	2010-01-21 15:14:10 +0000
+++ b/mysql-test/r/information_schema.result	2010-06-23 16:25:31 +0000
@@ -1747,4 +1747,21 @@ COUNT(*)
 DROP USER nonpriv;
 DROP TABLE db1.t1;
 DROP DATABASE db1;
+#
+# Bug #53814: NUMERIC_PRECISION for unsigned bigint field is 19, 
+# should be 20
+#
+CREATE TABLE ubig (a BIGINT, b BIGINT UNSIGNED);
+SELECT TABLE_NAME, COLUMN_NAME, NUMERIC_PRECISION 
+FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='ubig';
+TABLE_NAME	COLUMN_NAME	NUMERIC_PRECISION
+ubig	a	19
+ubig	b	20
+INSERT INTO ubig VALUES (0xFFFFFFFFFFFFFFFF,0xFFFFFFFFFFFFFFFF);
+Warnings:
+Warning	1264	Out of range value for column 'a' at row 1
+SELECT length(CAST(b AS CHAR)) FROM ubig;
+length(CAST(b AS CHAR))
+20
+DROP TABLE ubig;
 End of 5.1 tests.

=== modified file 'mysql-test/t/information_schema.test'
--- a/mysql-test/t/information_schema.test	2010-01-21 15:14:10 +0000
+++ b/mysql-test/t/information_schema.test	2010-06-23 16:25:31 +0000
@@ -1446,6 +1446,22 @@ DROP TABLE db1.t1;
 DROP DATABASE db1;
 
 
+--echo #
+--echo # Bug #53814: NUMERIC_PRECISION for unsigned bigint field is 19, 
+--echo # should be 20
+--echo #
+
+CREATE TABLE ubig (a BIGINT, b BIGINT UNSIGNED);
+
+SELECT TABLE_NAME, COLUMN_NAME, NUMERIC_PRECISION 
+  FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='ubig';
+
+INSERT INTO ubig VALUES (0xFFFFFFFFFFFFFFFF,0xFFFFFFFFFFFFFFFF);
+SELECT length(CAST(b AS CHAR)) FROM ubig;
+
+DROP TABLE ubig;
+
+
 --echo End of 5.1 tests.
 
 # Wait till all disconnects are completed

=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc	2010-06-10 20:45:22 +0000
+++ b/sql/sql_show.cc	2010-06-23 16:25:31 +0000
@@ -3940,10 +3940,13 @@ static int get_schema_column_record(THD 
     case MYSQL_TYPE_TINY:
     case MYSQL_TYPE_SHORT:
     case MYSQL_TYPE_LONG:
-    case MYSQL_TYPE_LONGLONG:
     case MYSQL_TYPE_INT24:
       field_length= field->max_display_length() - 1;
       break;
+    case MYSQL_TYPE_LONGLONG:
+      field_length= field->max_display_length() - 
+        ((field->flags & UNSIGNED_FLAG) ? 0 : 1);
+      break;
     case MYSQL_TYPE_BIT:
       field_length= field->max_display_length();
       decimals= -1;                             // return NULL


Attachment: [text/bzr-bundle] bzr/georgi.kodinov@oracle.com-20100623162531-ppx5dq6khkxhjxf4.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (Georgi.Kodinov:3438) Bug#53814Georgi Kodinov23 Jun