Commit c62a5942 authored by unknown's avatar unknown
Browse files

Fix error message when creating a non-string field with a display

width beyond the maximum. (Bug #6080)


mysql-test/r/errors.result:
  Update results
mysql-test/r/type_bit.result:
  Update results
mysql-test/r/type_bit_innodb.result:
  Update results
mysql-test/t/errors.test:
  Add new regression test
mysql-test/t/type_bit_innodb.test:
  Update error code in test
sql/share/errmsg.txt:
  Add new error message
sql/sql_parse.cc:
  Display more appropriate error message for column creation that
  fails due to a non-string field with a display width that is too
  big.
parent d17c9b06
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -23,3 +23,8 @@ ERROR 42S22: Unknown column 't1.b' in 'order clause'
select count(*),b from t1;
ERROR 42S22: Unknown column 'b' in 'field list'
drop table t1;
create table t1 (a int(256));
ERROR 42000: Display width out of range for column 'a' (max = 255)
set sql_mode='traditional';
create table t1 (a varchar(66000));
ERROR 42000: Column length too big for column 'a' (max = 65535); use BLOB or TEXT instead
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ select 0 + b'1000000000000001';
32769
drop table if exists t1;
create table t1 (a bit(65));
ERROR 42000: Column length too big for column 'a' (max = 64); use BLOB or TEXT instead
ERROR 42000: Display width out of range for column 'a' (max = 64)
create table t1 (a bit(0));
show create table t1;
Table	Create Table
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ select 0 + b'1000000000000001';
32769
drop table if exists t1;
create table t1 (a bit(65)) engine=innodb;
ERROR 42000: Column length too big for column 'a' (max = 64); use BLOB or TEXT instead
ERROR 42000: Display width out of range for column 'a' (max = 64)
create table t1 (a bit(0)) engine=innodb;
show create table t1;
Table	Create Table
+11 −0
Original line number Diff line number Diff line
@@ -31,3 +31,14 @@ select count(*),b from t1;
drop table t1;

# End of 4.1 tests

#
# Bug #6080: Error message for a field with a display width that is too long
#
--error 1438
create table t1 (a int(256));
set sql_mode='traditional';
--error 1074
create table t1 (a varchar(66000));

# End of 5.0 tests
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ select 0 + b'1000000000000001';
drop table if exists t1;
--enable_warnings

--error 1074
--error 1438
create table t1 (a bit(65)) engine=innodb;

create table t1 (a bit(0)) engine=innodb;
Loading