Commit ab8418a5 authored by unknown's avatar unknown

SHOW FIELDS changes, more SQL99 INFORMATION_SCHEMA.COLUMNS compatibility:

Character set is not displayed in "Type" column anymore
In "Collation" column NULL instead of BINARY is now displayd for for non-character data types


mysql-test/r/alter_table.result:
  Character set is not displayed in "Type" column of SHOW FIELDS anymore
mysql-test/r/create.result:
  Character set is not displayed in "Type" column of SHOW FIELDS anymore
mysql-test/r/ctype_collate.result:
  Character set is not displayed in "Type" column of SHOW FIELDS anymore
mysql-test/r/ctype_recoding.result:
  Character set is not displayed in "Type" column of SHOW FIELDS anymore
mysql-test/r/gis.result:
  Character set is not displayed in "Type" column of SHOW FIELDS anymore
mysql-test/r/innodb.result:
  Character set is not displayed in "Type" column of SHOW FIELDS anymore
mysql-test/r/select.result:
  Character set is not displayed in "Type" column of SHOW FIELDS anymore
mysql-test/r/show_check.result:
  Character set is not displayed in "Type" column of SHOW FIELDS anymore
mysql-test/r/type_blob.result:
  Character set is not displayed in "Type" column of SHOW FIELDS anymore
mysql-test/r/type_float.result:
  Character set is not displayed in "Type" column of SHOW FIELDS anymore
mysql-test/r/type_ranges.result:
  Character set is not displayed in "Type" column of SHOW FIELDS anymore
sql/field.cc:
  Character set is not displayed in "Type" column of SHOW FIELDS anymore
sql/field.h:
  Character set is not displayed in "Type" column of SHOW FIELDS anymore
sql/sql_show.cc:
  Character set is not displayed in "Type" column of SHOW FIELDS anymore
parent 493ba6ec
...@@ -51,8 +51,8 @@ KEY NAME (NAME)); ...@@ -51,8 +51,8 @@ KEY NAME (NAME));
ALTER TABLE t1 CHANGE NAME NAME CHAR(80) not null; ALTER TABLE t1 CHANGE NAME NAME CHAR(80) not null;
SHOW FULL COLUMNS FROM t1; SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
GROUP_ID int(10) unsigned binary PRI 0 select,insert,update,references GROUP_ID int(10) unsigned NULL PRI 0 select,insert,update,references
LANG_ID smallint(5) unsigned binary PRI 0 select,insert,update,references LANG_ID smallint(5) unsigned NULL PRI 0 select,insert,update,references
NAME char(80) latin1_swedish_ci MUL select,insert,update,references NAME char(80) latin1_swedish_ci MUL select,insert,update,references
DROP TABLE t1; DROP TABLE t1;
create table t1 (n int); create table t1 (n int);
...@@ -157,7 +157,7 @@ alter table t1 rename t2; ...@@ -157,7 +157,7 @@ alter table t1 rename t2;
alter table t2 rename t1, add c char(10) comment "no comment"; alter table t2 rename t1, add c char(10) comment "no comment";
show columns from t1; show columns from t1;
Field Type Collation Null Key Default Extra Field Type Collation Null Key Default Extra
i int(10) unsigned binary PRI NULL auto_increment i int(10) unsigned NULL PRI NULL auto_increment
c char(10) latin1_swedish_ci YES NULL c char(10) latin1_swedish_ci YES NULL
drop table t1; drop table t1;
create table t1 (a int, b int); create table t1 (a int, b int);
......
...@@ -91,28 +91,28 @@ drop table t2; ...@@ -91,28 +91,28 @@ drop table t2;
create table t2 select now() as a , curtime() as b, curdate() as c , 1+1 as d , 1.0 + 1 as e , 33333333333333333 + 3 as f; create table t2 select now() as a , curtime() as b, curdate() as c , 1+1 as d , 1.0 + 1 as e , 33333333333333333 + 3 as f;
describe t2; describe t2;
Field Type Collation Null Key Default Extra Field Type Collation Null Key Default Extra
a datetime latin1_swedish_ci 0000-00-00 00:00:00 a datetime NULL 0000-00-00 00:00:00
b time latin1_swedish_ci 00:00:00 b time NULL 00:00:00
c date latin1_swedish_ci 0000-00-00 c date NULL 0000-00-00
d bigint(17) binary 0 d bigint(17) NULL 0
e double(18,1) binary 0.0 e double(18,1) NULL 0.0
f bigint(17) binary 0 f bigint(17) NULL 0
drop table t2; drop table t2;
create table t2 select CAST("2001-12-29" AS DATE) as d, CAST("20:45:11" AS TIME) as t, CAST("2001-12-29 20:45:11" AS DATETIME) as dt; create table t2 select CAST("2001-12-29" AS DATE) as d, CAST("20:45:11" AS TIME) as t, CAST("2001-12-29 20:45:11" AS DATETIME) as dt;
describe t2; describe t2;
Field Type Collation Null Key Default Extra Field Type Collation Null Key Default Extra
d date latin1_swedish_ci 0000-00-00 d date NULL 0000-00-00
t time latin1_swedish_ci 00:00:00 t time NULL 00:00:00
dt datetime latin1_swedish_ci 0000-00-00 00:00:00 dt datetime NULL 0000-00-00 00:00:00
drop table t1,t2; drop table t1,t2;
create table t1 (a tinyint); create table t1 (a tinyint);
create table t2 (a int) select * from t1; create table t2 (a int) select * from t1;
describe t1; describe t1;
Field Type Collation Null Key Default Extra Field Type Collation Null Key Default Extra
a tinyint(4) binary YES NULL a tinyint(4) NULL YES NULL
describe t2; describe t2;
Field Type Collation Null Key Default Extra Field Type Collation Null Key Default Extra
a int(11) binary YES NULL a int(11) NULL YES NULL
drop table if exists t2; drop table if exists t2;
create table t2 (a int, a float) select * from t1; create table t2 (a int, a float) select * from t1;
Duplicate column name 'a' Duplicate column name 'a'
......
...@@ -500,7 +500,7 @@ t1 CREATE TABLE `t1` ( ...@@ -500,7 +500,7 @@ t1 CREATE TABLE `t1` (
) TYPE=MyISAM CHARSET=latin1 ) TYPE=MyISAM CHARSET=latin1
SHOW FIELDS FROM t1; SHOW FIELDS FROM t1;
Field Type Collation Null Key Default Extra Field Type Collation Null Key Default Extra
latin1_f char(32) character set latin1 latin1_bin YES NULL latin1_f char(32) latin1_bin YES NULL
ALTER TABLE t1 CHARACTER SET latin1 COLLATE latin1_bin; ALTER TABLE t1 CHARACTER SET latin1 COLLATE latin1_bin;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
......
...@@ -14,7 +14,7 @@ Table Create Table ...@@ -14,7 +14,7 @@ Table Create Table
) TYPE=MyISAM CHARSET=latin1 ) TYPE=MyISAM CHARSET=latin1
SHOW FIELDS FROM ; SHOW FIELDS FROM ;
Field Type Collation Null Key Default Extra Field Type Collation Null Key Default Extra
char(32) character set koi8r koi8r_general_ci char(32) koi8r_general_ci
SET CHARACTER SET cp1251; SET CHARACTER SET cp1251;
SHOW TABLES; SHOW TABLES;
Tables_in_test Tables_in_test
...@@ -26,7 +26,7 @@ Table Create Table ...@@ -26,7 +26,7 @@ Table Create Table
) TYPE=MyISAM CHARSET=latin1 ) TYPE=MyISAM CHARSET=latin1
SHOW FIELDS FROM ; SHOW FIELDS FROM ;
Field Type Collation Null Key Default Extra Field Type Collation Null Key Default Extra
char(32) character set koi8r koi8r_general_ci char(32) koi8r_general_ci
SET CHARACTER SET utf8; SET CHARACTER SET utf8;
SHOW TABLES; SHOW TABLES;
Tables_in_test Tables_in_test
...@@ -38,7 +38,7 @@ Table Create Table ...@@ -38,7 +38,7 @@ Table Create Table
) TYPE=MyISAM CHARSET=latin1 ) TYPE=MyISAM CHARSET=latin1
SHOW FIELDS FROM таблица; SHOW FIELDS FROM таблица;
Field Type Collation Null Key Default Extra Field Type Collation Null Key Default Extra
поле char(32) character set koi8r koi8r_general_ci поле char(32) koi8r_general_ci
SET CHARACTER SET koi8r; SET CHARACTER SET koi8r;
DROP TABLE ; DROP TABLE ;
SET CHARACTER SET default; SET CHARACTER SET default;
...@@ -9,36 +9,36 @@ CREATE TABLE gc (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRYCOLLECTION); ...@@ -9,36 +9,36 @@ CREATE TABLE gc (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRYCOLLECTION);
CREATE TABLE geo (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY); CREATE TABLE geo (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY);
SHOW FIELDS FROM pt; SHOW FIELDS FROM pt;
Field Type Collation Null Key Default Extra Field Type Collation Null Key Default Extra
fid int(11) binary PRI 0 fid int(11) NULL PRI 0
g point binary YES NULL g point NULL YES NULL
SHOW FIELDS FROM ls; SHOW FIELDS FROM ls;
Field Type Collation Null Key Default Extra Field Type Collation Null Key Default Extra
fid int(11) binary PRI 0 fid int(11) NULL PRI 0
g linestring binary YES NULL g linestring NULL YES NULL
SHOW FIELDS FROM p; SHOW FIELDS FROM p;
Field Type Collation Null Key Default Extra Field Type Collation Null Key Default Extra
fid int(11) binary PRI 0 fid int(11) NULL PRI 0
g polygon binary YES NULL g polygon NULL YES NULL
SHOW FIELDS FROM mpt; SHOW FIELDS FROM mpt;
Field Type Collation Null Key Default Extra Field Type Collation Null Key Default Extra
fid int(11) binary PRI 0 fid int(11) NULL PRI 0
g multipoint binary YES NULL g multipoint NULL YES NULL
SHOW FIELDS FROM mls; SHOW FIELDS FROM mls;
Field Type Collation Null Key Default Extra Field Type Collation Null Key Default Extra
fid int(11) binary PRI 0 fid int(11) NULL PRI 0
g multilinestring binary YES NULL g multilinestring NULL YES NULL
SHOW FIELDS FROM mp; SHOW FIELDS FROM mp;
Field Type Collation Null Key Default Extra Field Type Collation Null Key Default Extra
fid int(11) binary PRI 0 fid int(11) NULL PRI 0
g multipolygon binary YES NULL g multipolygon NULL YES NULL
SHOW FIELDS FROM gc; SHOW FIELDS FROM gc;
Field Type Collation Null Key Default Extra Field Type Collation Null Key Default Extra
fid int(11) binary PRI 0 fid int(11) NULL PRI 0
g geometrycollection binary YES NULL g geometrycollection NULL YES NULL
SHOW FIELDS FROM geo; SHOW FIELDS FROM geo;
Field Type Collation Null Key Default Extra Field Type Collation Null Key Default Extra
fid int(11) binary PRI 0 fid int(11) NULL PRI 0
g geometry binary YES NULL g geometry NULL YES NULL
INSERT INTO pt VALUES INSERT INTO pt VALUES
(101, PointFromText('POINT(10 10)')), (101, PointFromText('POINT(10 10)')),
(102, PointFromText('POINT(20 10)')), (102, PointFromText('POINT(20 10)')),
...@@ -367,26 +367,26 @@ gm geometry ...@@ -367,26 +367,26 @@ gm geometry
); );
SHOW FIELDS FROM g1; SHOW FIELDS FROM g1;
Field Type Collation Null Key Default Extra Field Type Collation Null Key Default Extra
pt point binary YES NULL pt point NULL YES NULL
ln linestring binary YES NULL ln linestring NULL YES NULL
pg polygon binary YES NULL pg polygon NULL YES NULL
mpt multipoint binary YES NULL mpt multipoint NULL YES NULL
mln multilinestring binary YES NULL mln multilinestring NULL YES NULL
mpg multipolygon binary YES NULL mpg multipolygon NULL YES NULL
gc geometrycollection binary YES NULL gc geometrycollection NULL YES NULL
gm geometry binary YES NULL gm geometry NULL YES NULL
ALTER TABLE g1 ADD fid INT NOT NULL; ALTER TABLE g1 ADD fid INT NOT NULL;
SHOW FIELDS FROM g1; SHOW FIELDS FROM g1;
Field Type Collation Null Key Default Extra Field Type Collation Null Key Default Extra
pt point binary YES NULL pt point NULL YES NULL
ln linestring binary YES NULL ln linestring NULL YES NULL
pg polygon binary YES NULL pg polygon NULL YES NULL
mpt multipoint binary YES NULL mpt multipoint NULL YES NULL
mln multilinestring binary YES NULL mln multilinestring NULL YES NULL
mpg multipolygon binary YES NULL mpg multipolygon NULL YES NULL
gc geometrycollection binary YES NULL gc geometrycollection NULL YES NULL
gm geometry binary YES NULL gm geometry NULL YES NULL
fid int(11) binary 0 fid int(11) NULL 0
DROP TABLE g1; DROP TABLE g1;
SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)')))); SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)')))) AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))
......
...@@ -907,7 +907,7 @@ drop table t1; ...@@ -907,7 +907,7 @@ drop table t1;
create table t1 (t int not null default 1, key (t)) type=innodb; create table t1 (t int not null default 1, key (t)) type=innodb;
desc t1; desc t1;
Field Type Collation Null Key Default Extra Field Type Collation Null Key Default Extra
t int(11) binary MUL 1 t int(11) NULL MUL 1
drop table t1; drop table t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
number bigint(20) NOT NULL default '0', number bigint(20) NOT NULL default '0',
......
...@@ -3218,16 +3218,16 @@ show tables from test like "t?"; ...@@ -3218,16 +3218,16 @@ show tables from test like "t?";
Tables_in_test (t?) Tables_in_test (t?)
show full columns from t2; show full columns from t2;
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
auto int(11) binary PRI NULL auto_increment select,insert,update,references auto int(11) NULL PRI NULL auto_increment select,insert,update,references
fld1 int(6) unsigned zerofill binary UNI 000000 select,insert,update,references fld1 int(6) unsigned zerofill NULL UNI 000000 select,insert,update,references
companynr tinyint(2) unsigned zerofill binary 00 select,insert,update,references companynr tinyint(2) unsigned zerofill NULL 00 select,insert,update,references
fld3 char(30) latin1_swedish_ci MUL select,insert,update,references fld3 char(30) latin1_swedish_ci MUL select,insert,update,references
fld4 char(35) latin1_swedish_ci select,insert,update,references fld4 char(35) latin1_swedish_ci select,insert,update,references
fld5 char(35) latin1_swedish_ci select,insert,update,references fld5 char(35) latin1_swedish_ci select,insert,update,references
fld6 char(4) latin1_swedish_ci select,insert,update,references fld6 char(4) latin1_swedish_ci select,insert,update,references
show full columns from t2 from test like 'f%'; show full columns from t2 from test like 'f%';
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
fld1 int(6) unsigned zerofill binary UNI 000000 select,insert,update,references fld1 int(6) unsigned zerofill NULL UNI 000000 select,insert,update,references
fld3 char(30) latin1_swedish_ci MUL select,insert,update,references fld3 char(30) latin1_swedish_ci MUL select,insert,update,references
fld4 char(35) latin1_swedish_ci select,insert,update,references fld4 char(35) latin1_swedish_ci select,insert,update,references
fld5 char(35) latin1_swedish_ci select,insert,update,references fld5 char(35) latin1_swedish_ci select,insert,update,references
......
...@@ -101,7 +101,7 @@ show full columns from t1; ...@@ -101,7 +101,7 @@ show full columns from t1;
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
test_set set('val1','val2','val3') latin1_swedish_ci select,insert,update,references test_set set('val1','val2','val3') latin1_swedish_ci select,insert,update,references
name char(20) latin1_swedish_ci YES O'Brien select,insert,update,references O'Brien as default name char(20) latin1_swedish_ci YES O'Brien select,insert,update,references O'Brien as default
c int(11) binary 0 select,insert,update,references int column c int(11) NULL 0 select,insert,update,references int column
drop table t1; drop table t1;
create table t1 (a int not null, unique aa (a)); create table t1 (a int not null, unique aa (a));
show create table t1; show create table t1;
...@@ -156,20 +156,20 @@ drop table t1; ...@@ -156,20 +156,20 @@ drop table t1;
create table t1 (a decimal(9,2), b decimal (9,0), e double(9,2), f double(5,0), h float(3,2), i float(3,0)); create table t1 (a decimal(9,2), b decimal (9,0), e double(9,2), f double(5,0), h float(3,2), i float(3,0));
show columns from t1; show columns from t1;
Field Type Collation Null Key Default Extra Field Type Collation Null Key Default Extra
a decimal(9,2) binary YES NULL a decimal(9,2) NULL YES NULL
b decimal(9,0) binary YES NULL b decimal(9,0) NULL YES NULL
e double(9,2) binary YES NULL e double(9,2) NULL YES NULL
f double(5,0) binary YES NULL f double(5,0) NULL YES NULL
h float(3,2) binary YES NULL h float(3,2) NULL YES NULL
i float(3,0) binary YES NULL i float(3,0) NULL YES NULL
show full columns from t1; show full columns from t1;
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
a decimal(9,2) binary YES NULL select,insert,update,references a decimal(9,2) NULL YES NULL select,insert,update,references
b decimal(9,0) binary YES NULL select,insert,update,references b decimal(9,0) NULL YES NULL select,insert,update,references
e double(9,2) binary YES NULL select,insert,update,references e double(9,2) NULL YES NULL select,insert,update,references
f double(5,0) binary YES NULL select,insert,update,references f double(5,0) NULL YES NULL select,insert,update,references
h float(3,2) binary YES NULL select,insert,update,references h float(3,2) NULL YES NULL select,insert,update,references
i float(3,0) binary YES NULL select,insert,update,references i float(3,0) NULL YES NULL select,insert,update,references
drop table t1; drop table t1;
create table t1 ( create table t1 (
type_bool bool not null, type_bool bool not null,
...@@ -230,15 +230,15 @@ drop table t1; ...@@ -230,15 +230,15 @@ drop table t1;
create table t1 (c decimal, d double, f float, r real); create table t1 (c decimal, d double, f float, r real);
show columns from t1; show columns from t1;
Field Type Collation Null Key Default Extra Field Type Collation Null Key Default Extra
c decimal(10,0) binary YES NULL c decimal(10,0) NULL YES NULL
d double binary YES NULL d double NULL YES NULL
f float binary YES NULL f float NULL YES NULL
r double binary YES NULL r double NULL YES NULL
drop table t1; drop table t1;
create table t1 (c decimal(3,3), d double(3,3), f float(3,3)); create table t1 (c decimal(3,3), d double(3,3), f float(3,3));
show columns from t1; show columns from t1;
Field Type Collation Null Key Default Extra Field Type Collation Null Key Default Extra
c decimal(4,3) binary YES NULL c decimal(4,3) NULL YES NULL
d double(4,3) binary YES NULL d double(4,3) NULL YES NULL
f float(4,3) binary YES NULL f float(4,3) NULL YES NULL
drop table t1; drop table t1;
...@@ -2,9 +2,9 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7; ...@@ -2,9 +2,9 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7;
CREATE TABLE t1 (a blob, b text, c blob(250), d text(70000), e text(70000000)); CREATE TABLE t1 (a blob, b text, c blob(250), d text(70000), e text(70000000));
show columns from t1; show columns from t1;
Field Type Collation Null Key Default Extra Field Type Collation Null Key Default Extra
a blob binary YES NULL a blob NULL YES NULL
b text latin1_swedish_ci YES NULL b text latin1_swedish_ci YES NULL
c blob binary YES NULL c blob NULL YES NULL
d mediumtext latin1_swedish_ci YES NULL d mediumtext latin1_swedish_ci YES NULL
e longtext latin1_swedish_ci YES NULL e longtext latin1_swedish_ci YES NULL
CREATE TABLE t2 (a char(257), b varchar(70000) binary, c varchar(70000000)); CREATE TABLE t2 (a char(257), b varchar(70000) binary, c varchar(70000000));
...@@ -15,7 +15,7 @@ Warning 1244 Converting column 'c' from CHAR to TEXT ...@@ -15,7 +15,7 @@ Warning 1244 Converting column 'c' from CHAR to TEXT
show columns from t2; show columns from t2;
Field Type Collation Null Key Default Extra Field Type Collation Null Key Default Extra
a text latin1_swedish_ci YES NULL a text latin1_swedish_ci YES NULL
b mediumblob binary YES NULL b mediumblob NULL YES NULL
c longtext latin1_swedish_ci YES NULL c longtext latin1_swedish_ci YES NULL
create table t3 (a long, b long byte); create table t3 (a long, b long byte);
show create TABLE t3; show create TABLE t3;
...@@ -72,15 +72,15 @@ show full fields from t1; ...@@ -72,15 +72,15 @@ show full fields from t1;
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
t text latin1_swedish_ci YES NULL select,insert,update,references t text latin1_swedish_ci YES NULL select,insert,update,references
c varchar(10) latin1_swedish_ci YES NULL select,insert,update,references c varchar(10) latin1_swedish_ci YES NULL select,insert,update,references
b blob binary YES NULL select,insert,update,references b blob NULL YES NULL select,insert,update,references
d varchar(10) binary binary YES NULL select,insert,update,references d varchar(10) binary YES NULL select,insert,update,references
lock tables t1 WRITE; lock tables t1 WRITE;
show full fields from t1; show full fields from t1;
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
t text latin1_swedish_ci YES NULL select,insert,update,references t text latin1_swedish_ci YES NULL select,insert,update,references
c varchar(10) latin1_swedish_ci YES NULL select,insert,update,references c varchar(10) latin1_swedish_ci YES NULL select,insert,update,references
b blob binary YES NULL select,insert,update,references b blob NULL YES NULL select,insert,update,references
d varchar(10) binary binary YES NULL select,insert,update,references d varchar(10) binary YES NULL select,insert,update,references
unlock tables; unlock tables;
select t from t1 where t like "hello"; select t from t1 where t like "hello";
t t
......
...@@ -11,8 +11,8 @@ SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1; ...@@ -11,8 +11,8 @@ SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1;
create table t1 (f1 float(24),f2 float(52)); create table t1 (f1 float(24),f2 float(52));
show full columns from t1; show full columns from t1;
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
f1 float binary YES NULL select,insert,update,references f1 float NULL YES NULL select,insert,update,references
f2 double binary YES NULL select,insert,update,references f2 double NULL YES NULL select,insert,update,references
insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150); insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150);
Warnings: Warnings:
Warning 1262 Data truncated, out of range for column 'f1' at row 7 Warning 1262 Data truncated, out of range for column 'f1' at row 7
...@@ -73,18 +73,18 @@ drop table t1; ...@@ -73,18 +73,18 @@ drop table t1;
create table t1 (f float, f2 float(24), f3 float(6,2), d double, d2 float(53), d3 double(10,3), de decimal, de2 decimal(6), de3 decimal(5,2), n numeric, n2 numeric(8), n3 numeric(5,6)); create table t1 (f float, f2 float(24), f3 float(6,2), d double, d2 float(53), d3 double(10,3), de decimal, de2 decimal(6), de3 decimal(5,2), n numeric, n2 numeric(8), n3 numeric(5,6));
show full columns from t1; show full columns from t1;
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
f float binary YES NULL select,insert,update,references f float NULL YES NULL select,insert,update,references
f2 float binary YES NULL select,insert,update,references f2 float NULL YES NULL select,insert,update,references
f3 float(6,2) binary YES NULL select,insert,update,references f3 float(6,2) NULL YES NULL select,insert,update,references
d double binary YES NULL select,insert,update,references d double NULL YES NULL select,insert,update,references
d2 double binary YES NULL select,insert,update,references d2 double NULL YES NULL select,insert,update,references
d3 double(10,3) binary YES NULL select,insert,update,references d3 double(10,3) NULL YES NULL select,insert,update,references
de decimal(10,0) binary YES NULL select,insert,update,references de decimal(10,0) NULL YES NULL select,insert,update,references
de2 decimal(6,0) binary YES NULL select,insert,update,references de2 decimal(6,0) NULL YES NULL select,insert,update,references
de3 decimal(5,2) binary YES NULL select,insert,update,references de3 decimal(5,2) NULL YES NULL select,insert,update,references
n decimal(10,0) binary YES NULL select,insert,update,references n decimal(10,0) NULL YES NULL select,insert,update,references
n2 decimal(8,0) binary YES NULL select,insert,update,references n2 decimal(8,0) NULL YES NULL select,insert,update,references
n3 decimal(7,6) binary YES NULL select,insert,update,references n3 decimal(7,6) NULL YES NULL select,insert,update,references
drop table t1; drop table t1;
create table t1 (a decimal(7,3) not null, key (a)); create table t1 (a decimal(7,3) not null, key (a));
insert into t1 values ("0"),("-0.00"),("-0.01"),("-0.002"),("1"); insert into t1 values ("0"),("-0.00"),("-0.01"),("-0.002"),("1");
......
This diff is collapsed.
...@@ -254,26 +254,6 @@ void Field_str::make_field(Send_field *field) ...@@ -254,26 +254,6 @@ void Field_str::make_field(Send_field *field)
} }
void Field_str::add_binary_or_charset(String &res) const
{
if (charset() == &my_charset_bin)
res.append(" binary");
else if (field_charset != table->table_charset &&
!(current_thd->variables.sql_mode & MODE_NO_FIELD_OPTIONS) &&
!(current_thd->variables.sql_mode & MODE_MYSQL323) &&
!(current_thd->variables.sql_mode & MODE_MYSQL40) &&
!(current_thd->variables.sql_mode & MODE_POSTGRESQL) &&
!(current_thd->variables.sql_mode & MODE_ORACLE) &&
!(current_thd->variables.sql_mode & MODE_MSSQL) &&
!(current_thd->variables.sql_mode & MODE_DB2) &&
!(current_thd->variables.sql_mode & MODE_SAPDB))
{
res.append(" character set ");
res.append(field_charset->csname);
}
}
uint Field::fill_cache_field(CACHE_FIELD *copy) uint Field::fill_cache_field(CACHE_FIELD *copy)
{ {
copy->str=ptr; copy->str=ptr;
...@@ -4027,7 +4007,6 @@ void Field_string::sql_type(String &res) const ...@@ -4027,7 +4007,6 @@ void Field_string::sql_type(String &res) const
"varchar" : "char"), "varchar" : "char"),
(int) field_length); (int) field_length);
res.length(length); res.length(length);
add_binary_or_charset(res);
} }
...@@ -4194,7 +4173,6 @@ void Field_varstring::sql_type(String &res) const ...@@ -4194,7 +4173,6 @@ void Field_varstring::sql_type(String &res) const
res.alloced_length(),"varchar(%u)", res.alloced_length(),"varchar(%u)",
field_length); field_length);
res.length(length); res.length(length);
add_binary_or_charset(res);
} }
char *Field_varstring::pack(char *to, const char *from, uint max_length) char *Field_varstring::pack(char *to, const char *from, uint max_length)
...@@ -4640,11 +4618,6 @@ void Field_blob::sql_type(String &res) const ...@@ -4640,11 +4618,6 @@ void Field_blob::sql_type(String &res) const
else else
{ {
res.append("text"); res.append("text");
if (field_charset != table->table_charset)
{
res.append(" character set ");
res.append(field_charset->csname);
}
} }
} }
...@@ -5098,7 +5071,6 @@ void Field_enum::sql_type(String &res) const ...@@ -5098,7 +5071,6 @@ void Field_enum::sql_type(String &res) const
flag=1; flag=1;
} }
res.append(')'); res.append(')');
add_binary_or_charset(res);
} }
...@@ -5243,7 +5215,6 @@ void Field_set::sql_type(String &res) const ...@@ -5243,7 +5215,6 @@ void Field_set::sql_type(String &res) const
flag=1; flag=1;
} }
res.append(')'); res.append(')');
add_binary_or_charset(res);
} }
/* returns 1 if the fields are equally defined */ /* returns 1 if the fields are equally defined */
......
...@@ -211,6 +211,7 @@ public: ...@@ -211,6 +211,7 @@ public:
virtual bool get_date(TIME *ltime,bool fuzzydate); virtual bool get_date(TIME *ltime,bool fuzzydate);
virtual bool get_time(TIME *ltime); virtual bool get_time(TIME *ltime);
virtual CHARSET_INFO *charset(void) const { return &my_charset_bin; } virtual CHARSET_INFO *charset(void) const { return &my_charset_bin; }
virtual bool has_charset(void) const { return FALSE; }
virtual void set_charset(CHARSET_INFO *charset) { } virtual void set_charset(CHARSET_INFO *charset) { }
virtual void set_warning(const unsigned int level, virtual void set_warning(const unsigned int level,
const unsigned int code); const unsigned int code);
...@@ -277,12 +278,10 @@ public: ...@@ -277,12 +278,10 @@ public:
flags|=BINARY_FLAG; flags|=BINARY_FLAG;
} }
Item_result result_type () const { return STRING_RESULT; } Item_result result_type () const { return STRING_RESULT; }
void add_binary_or_charset(String &res) const;
uint decimals() const { return NOT_FIXED_DEC; } uint decimals() const { return NOT_FIXED_DEC; }
void make_field(Send_field *); void make_field(Send_field *);
uint size_of() const { return sizeof(*this); } uint size_of() const { return sizeof(*this); }
CHARSET_INFO *charset(void) const { return field_charset; } CHARSET_INFO *charset(void) const { return field_charset; }
void set_charset(CHARSET_INFO *charset) { field_charset=charset; } void set_charset(CHARSET_INFO *charset) { field_charset=charset; }
bool binary() const { return field_charset->state & MY_CS_BINSORT ? 1 : 0; } bool binary() const { return field_charset->state & MY_CS_BINSORT ? 1 : 0; }
friend class create_field; friend class create_field;
...@@ -807,6 +806,7 @@ public: ...@@ -807,6 +806,7 @@ public:
uint max_packed_col_length(uint max_length); uint max_packed_col_length(uint max_length);
uint size_of() const { return sizeof(*this); } uint size_of() const { return sizeof(*this); }
enum_field_types real_type() const { return FIELD_TYPE_STRING; } enum_field_types real_type() const { return FIELD_TYPE_STRING; }
bool has_charset(void) const { return TRUE; }
}; };
...@@ -849,6 +849,7 @@ public: ...@@ -849,6 +849,7 @@ public:
uint max_packed_col_length(uint max_length); uint max_packed_col_length(uint max_length);
uint size_of() const { return sizeof(*this); } uint size_of() const { return sizeof(*this); }
enum_field_types real_type() const { return FIELD_TYPE_VAR_STRING; } enum_field_types real_type() const { return FIELD_TYPE_VAR_STRING; }
bool has_charset(void) const { return TRUE; }
}; };
...@@ -936,6 +937,8 @@ public: ...@@ -936,6 +937,8 @@ public:
inline void clear_temporary() { bzero((char*) &value,sizeof(value)); } inline void clear_temporary() { bzero((char*) &value,sizeof(value)); }
friend void field_conv(Field *to,Field *from); friend void field_conv(Field *to,Field *from);
uint size_of() const { return sizeof(*this); } uint size_of() const { return sizeof(*this); }
bool has_charset(void) const
{ return charset() == &my_charset_bin ? FALSE : TRUE; }
}; };
...@@ -1004,6 +1007,7 @@ public: ...@@ -1004,6 +1007,7 @@ public:
virtual bool zero_pack() const { return 0; } virtual bool zero_pack() const { return 0; }
bool optimize_range(uint idx) { return 0; } bool optimize_range(uint idx) { return 0; }
bool eq_def(Field *field); bool eq_def(Field *field);
bool has_charset(void) const { return TRUE; }
}; };
...@@ -1028,6 +1032,7 @@ public: ...@@ -1028,6 +1032,7 @@ public:
String *val_str(String*,String *); String *val_str(String*,String *);
void sql_type(String &str) const; void sql_type(String &str) const;
enum_field_types real_type() const { return FIELD_TYPE_SET; } enum_field_types real_type() const { return FIELD_TYPE_SET; }
bool has_charset(void) const { return TRUE; }
}; };
......
...@@ -719,8 +719,8 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild, ...@@ -719,8 +719,8 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
protocol->store(field->field_name, system_charset_info); protocol->store(field->field_name, system_charset_info);
field->sql_type(type); field->sql_type(type);
protocol->store(type.ptr(), type.length(), system_charset_info); protocol->store(type.ptr(), type.length(), system_charset_info);
protocol->store(field->charset()->name, system_charset_info); protocol->store(field->has_charset() ? field->charset()->name : "NULL",
system_charset_info);
pos=(byte*) ((flags & NOT_NULL_FLAG) && pos=(byte*) ((flags & NOT_NULL_FLAG) &&
field->type() != FIELD_TYPE_TIMESTAMP ? field->type() != FIELD_TYPE_TIMESTAMP ?
"" : "YES"); "" : "YES");
...@@ -1073,23 +1073,36 @@ store_create_info(THD *thd, TABLE *table, String *packet) ...@@ -1073,23 +1073,36 @@ store_create_info(THD *thd, TABLE *table, String *packet)
field->sql_type(type); field->sql_type(type);
packet->append(type.ptr(),type.length()); packet->append(type.ptr(),type.length());
bool has_default = (field->type() != FIELD_TYPE_BLOB && if (field->has_charset())
field->type() != FIELD_TYPE_TIMESTAMP &&
field->unireg_check != Field::NEXT_NUMBER);
/*
For string types dump collation name only if
collation is not primary for the given charset
*/
if (!(field->charset()->state & MY_CS_PRIMARY) &&
!limited_mysql_mode && !foreign_db_mode)
{ {
packet->append(" collate ", 9); if (field->charset() == &my_charset_bin)
packet->append(field->charset()->name); packet->append(" binary");
else if (!limited_mysql_mode && !foreign_db_mode)
{
if (field->charset() != table->table_charset)
{
packet->append(" character set ");
packet->append(field->charset()->csname);
}
/*
For string types dump collation name only if
collation is not primary for the given charset
*/
if (!(field->charset()->state & MY_CS_PRIMARY))
{
packet->append(" collate ", 9);
packet->append(field->charset()->name);
}
}
} }
if (flags & NOT_NULL_FLAG) if (flags & NOT_NULL_FLAG)
packet->append(" NOT NULL", 9); packet->append(" NOT NULL", 9);
bool has_default = (field->type() != FIELD_TYPE_BLOB &&
field->type() != FIELD_TYPE_TIMESTAMP &&
field->unireg_check != Field::NEXT_NUMBER);
if (has_default) if (has_default)
{ {
packet->append(" default ", 9); packet->append(" default ", 9);
......
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