Commit 25bfbf68 authored by Georgi Kodinov's avatar Georgi Kodinov

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.
parent 53e29848
......@@ -1757,4 +1757,21 @@ WHERE INFORMATION_SCHEMA.COLUMNS.TABLE_NAME = 'variables';
COLUMN_DEFAULT TABLE_NAME
NULL variables
DROP TABLE variables;
#
# 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.
......@@ -1455,6 +1455,22 @@ FROM INFORMATION_SCHEMA.COLUMNS
WHERE INFORMATION_SCHEMA.COLUMNS.TABLE_NAME = 'variables';
DROP TABLE variables;
--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
......
......@@ -3965,10 +3965,13 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment