Commit 4beedd51 authored by unknown's avatar unknown

"Collation" has been moved to SHOW FULL FIELDS

SHOW COLLATION columns have been removed:
  D -> Default
  C -> Compiled
  Y -> Yes

parent 31121b36
...@@ -156,9 +156,9 @@ create table t1 (i int unsigned not null auto_increment primary key); ...@@ -156,9 +156,9 @@ create table t1 (i int unsigned not null auto_increment primary key);
alter table t1 rename t2; 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 Null Key Default Extra
i int(10) unsigned NULL PRI NULL auto_increment i int(10) unsigned PRI NULL auto_increment
c char(10) latin1_swedish_ci YES NULL c char(10) YES NULL
drop table t1; drop table t1;
create table t1 (a int, b int); create table t1 (a int, b int);
insert into t1 values(1,100), (2,100), (3, 100); insert into t1 values(1,100), (2,100), (3, 100);
......
...@@ -82,37 +82,37 @@ drop table t1,t2; ...@@ -82,37 +82,37 @@ drop table t1,t2;
create table t1(x varchar(50) ); create table t1(x varchar(50) );
create table t2 select x from t1 where 1=2; create table t2 select x from t1 where 1=2;
describe t1; describe t1;
Field Type Collation Null Key Default Extra Field Type Null Key Default Extra
x varchar(50) latin1_swedish_ci YES NULL x varchar(50) YES NULL
describe t2; describe t2;
Field Type Collation Null Key Default Extra Field Type Null Key Default Extra
x char(50) latin1_swedish_ci YES NULL x char(50) YES NULL
drop table t2; 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 Null Key Default Extra
a datetime NULL 0000-00-00 00:00:00 a datetime 0000-00-00 00:00:00
b time NULL 00:00:00 b time 00:00:00
c date NULL 0000-00-00 c date 0000-00-00
d bigint(17) NULL 0 d bigint(17) 0
e double(18,1) NULL 0.0 e double(18,1) 0.0
f bigint(17) NULL 0 f bigint(17) 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 Null Key Default Extra
d date NULL 0000-00-00 d date 0000-00-00
t time NULL 00:00:00 t time 00:00:00
dt datetime NULL 0000-00-00 00:00:00 dt datetime 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 Null Key Default Extra
a tinyint(4) NULL YES NULL a tinyint(4) YES NULL
describe t2; describe t2;
Field Type Collation Null Key Default Extra Field Type Null Key Default Extra
a int(11) NULL YES NULL a int(11) 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'
......
...@@ -489,8 +489,8 @@ t1 CREATE TABLE `t1` ( ...@@ -489,8 +489,8 @@ t1 CREATE TABLE `t1` (
`latin1_f` char(32) NOT NULL default '' `latin1_f` char(32) NOT NULL default ''
) 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 Null Key Default Extra
latin1_f char(32) latin1_swedish_ci latin1_f char(32)
ALTER TABLE t1 CHANGE latin1_f ALTER TABLE t1 CHANGE latin1_f
latin1_f CHAR(32) CHARACTER SET latin1 COLLATE latin1_bin; latin1_f CHAR(32) CHARACTER SET latin1 COLLATE latin1_bin;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
...@@ -499,8 +499,8 @@ t1 CREATE TABLE `t1` ( ...@@ -499,8 +499,8 @@ t1 CREATE TABLE `t1` (
`latin1_f` char(32) character set latin1 collate latin1_bin default NULL `latin1_f` char(32) character set latin1 collate latin1_bin default NULL
) 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 Null Key Default Extra
latin1_f char(32) latin1_bin YES NULL latin1_f char(32) 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
...@@ -508,8 +508,8 @@ t1 CREATE TABLE `t1` ( ...@@ -508,8 +508,8 @@ t1 CREATE TABLE `t1` (
`latin1_f` char(32) collate latin1_bin default NULL `latin1_f` char(32) collate latin1_bin default NULL
) TYPE=MyISAM CHARSET=latin1 COLLATE=latin1_bin ) TYPE=MyISAM CHARSET=latin1 COLLATE=latin1_bin
SHOW FIELDS FROM t1; SHOW FIELDS FROM t1;
Field Type Collation Null Key Default Extra Field Type Null Key Default Extra
latin1_f char(32) latin1_bin YES NULL latin1_f char(32) YES NULL
SET CHARACTER SET 'latin1'; SET CHARACTER SET 'latin1';
SHOW VARIABLES LIKE 'character_set_client'; SHOW VARIABLES LIKE 'character_set_client';
Variable_name Value Variable_name Value
......
...@@ -13,8 +13,8 @@ Table Create Table ...@@ -13,8 +13,8 @@ Table Create Table
`` char(32) character set koi8r NOT NULL default '' `` char(32) character set koi8r NOT NULL default ''
) TYPE=MyISAM CHARSET=latin1 ) TYPE=MyISAM CHARSET=latin1
SHOW FIELDS FROM ; SHOW FIELDS FROM ;
Field Type Collation Null Key Default Extra Field Type Null Key Default Extra
char(32) koi8r_general_ci char(32)
SET CHARACTER SET cp1251; SET CHARACTER SET cp1251;
SHOW TABLES; SHOW TABLES;
Tables_in_test Tables_in_test
...@@ -25,8 +25,8 @@ Table Create Table ...@@ -25,8 +25,8 @@ Table Create Table
`` char(32) character set koi8r NOT NULL default '' `` char(32) character set koi8r NOT NULL default ''
) TYPE=MyISAM CHARSET=latin1 ) TYPE=MyISAM CHARSET=latin1
SHOW FIELDS FROM ; SHOW FIELDS FROM ;
Field Type Collation Null Key Default Extra Field Type Null Key Default Extra
char(32) koi8r_general_ci char(32)
SET CHARACTER SET utf8; SET CHARACTER SET utf8;
SHOW TABLES; SHOW TABLES;
Tables_in_test Tables_in_test
...@@ -37,8 +37,8 @@ Table Create Table ...@@ -37,8 +37,8 @@ Table Create Table
`поле` char(32) character set koi8r NOT NULL default '' `поле` char(32) character set koi8r NOT NULL default ''
) TYPE=MyISAM CHARSET=latin1 ) TYPE=MyISAM CHARSET=latin1
SHOW FIELDS FROM таблица; SHOW FIELDS FROM таблица;
Field Type Collation Null Key Default Extra Field Type Null Key Default Extra
поле char(32) koi8r_general_ci поле char(32)
SET CHARACTER SET koi8r; SET CHARACTER SET koi8r;
DROP TABLE ; DROP TABLE ;
SET CHARACTER SET default; SET CHARACTER SET default;
...@@ -8,37 +8,37 @@ CREATE TABLE mp (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOLYGON); ...@@ -8,37 +8,37 @@ CREATE TABLE mp (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOLYGON);
CREATE TABLE gc (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRYCOLLECTION); 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 Null Key Default Extra
fid int(11) NULL PRI 0 fid int(11) PRI 0
g point NULL YES NULL g point YES NULL
SHOW FIELDS FROM ls; SHOW FIELDS FROM ls;
Field Type Collation Null Key Default Extra Field Type Null Key Default Extra
fid int(11) NULL PRI 0 fid int(11) PRI 0
g linestring NULL YES NULL g linestring YES NULL
SHOW FIELDS FROM p; SHOW FIELDS FROM p;
Field Type Collation Null Key Default Extra Field Type Null Key Default Extra
fid int(11) NULL PRI 0 fid int(11) PRI 0
g polygon NULL YES NULL g polygon YES NULL
SHOW FIELDS FROM mpt; SHOW FIELDS FROM mpt;
Field Type Collation Null Key Default Extra Field Type Null Key Default Extra
fid int(11) NULL PRI 0 fid int(11) PRI 0
g multipoint NULL YES NULL g multipoint YES NULL
SHOW FIELDS FROM mls; SHOW FIELDS FROM mls;
Field Type Collation Null Key Default Extra Field Type Null Key Default Extra
fid int(11) NULL PRI 0 fid int(11) PRI 0
g multilinestring NULL YES NULL g multilinestring YES NULL
SHOW FIELDS FROM mp; SHOW FIELDS FROM mp;
Field Type Collation Null Key Default Extra Field Type Null Key Default Extra
fid int(11) NULL PRI 0 fid int(11) PRI 0
g multipolygon NULL YES NULL g multipolygon YES NULL
SHOW FIELDS FROM gc; SHOW FIELDS FROM gc;
Field Type Collation Null Key Default Extra Field Type Null Key Default Extra
fid int(11) NULL PRI 0 fid int(11) PRI 0
g geometrycollection NULL YES NULL g geometrycollection YES NULL
SHOW FIELDS FROM geo; SHOW FIELDS FROM geo;
Field Type Collation Null Key Default Extra Field Type Null Key Default Extra
fid int(11) NULL PRI 0 fid int(11) PRI 0
g geometry NULL YES NULL g geometry 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)')),
...@@ -366,27 +366,27 @@ gc geometrycollection, ...@@ -366,27 +366,27 @@ gc geometrycollection,
gm geometry gm geometry
); );
SHOW FIELDS FROM g1; SHOW FIELDS FROM g1;
Field Type Collation Null Key Default Extra Field Type Null Key Default Extra
pt point NULL YES NULL pt point YES NULL
ln linestring NULL YES NULL ln linestring YES NULL
pg polygon NULL YES NULL pg polygon YES NULL
mpt multipoint NULL YES NULL mpt multipoint YES NULL
mln multilinestring NULL YES NULL mln multilinestring YES NULL
mpg multipolygon NULL YES NULL mpg multipolygon YES NULL
gc geometrycollection NULL YES NULL gc geometrycollection YES NULL
gm geometry NULL YES NULL gm geometry 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 Null Key Default Extra
pt point NULL YES NULL pt point YES NULL
ln linestring NULL YES NULL ln linestring YES NULL
pg polygon NULL YES NULL pg polygon YES NULL
mpt multipoint NULL YES NULL mpt multipoint YES NULL
mln multilinestring NULL YES NULL mln multilinestring YES NULL
mpg multipolygon NULL YES NULL mpg multipolygon YES NULL
gc geometrycollection NULL YES NULL gc geometrycollection YES NULL
gm geometry NULL YES NULL gm geometry YES NULL
fid int(11) NULL 0 fid int(11) 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)'))))
......
Collation Charset Id D C Sortlen Collation Charset Id Default Compiled Sortlen
ucs2_general_ci ucs2 35 Y Y 1 ucs2_general_ci ucs2 35 Yes Yes 1
Collation Charset Id D C Sortlen Collation Charset Id Default Compiled Sortlen
ujis_japanese_ci ujis 12 Y Y 0 ujis_japanese_ci ujis 12 Yes Yes 0
...@@ -906,8 +906,8 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -906,8 +906,8 @@ id select_type table type possible_keys key key_len ref rows Extra
drop table t1; 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 Null Key Default Extra
t int(11) NULL MUL 1 t int(11) 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',
......
...@@ -155,13 +155,13 @@ t1 CREATE TABLE `t1` ( ...@@ -155,13 +155,13 @@ t1 CREATE TABLE `t1` (
drop table t1; 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 Null Key Default Extra
a decimal(9,2) NULL YES NULL a decimal(9,2) YES NULL
b decimal(9,0) NULL YES NULL b decimal(9,0) YES NULL
e double(9,2) NULL YES NULL e double(9,2) YES NULL
f double(5,0) NULL YES NULL f double(5,0) YES NULL
h float(3,2) NULL YES NULL h float(3,2) YES NULL
i float(3,0) NULL YES NULL i float(3,0) 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) NULL YES NULL select,insert,update,references a decimal(9,2) NULL YES NULL select,insert,update,references
...@@ -229,16 +229,16 @@ type_bool type_tiny type_short type_mediumint type_bigint type_decimal type_nume ...@@ -229,16 +229,16 @@ type_bool type_tiny type_short type_mediumint type_bigint type_decimal type_nume
drop table t1; 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 Null Key Default Extra
c decimal(10,0) NULL YES NULL c decimal(10,0) YES NULL
d double NULL YES NULL d double YES NULL
f float NULL YES NULL f float YES NULL
r double NULL YES NULL r double 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 Null Key Default Extra
c decimal(4,3) NULL YES NULL c decimal(4,3) YES NULL
d double(4,3) NULL YES NULL d double(4,3) YES NULL
f float(4,3) NULL YES NULL f float(4,3) YES NULL
drop table t1; drop table t1;
drop table if exists t1,t2,t3,t4,t5,t6,t7; 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 Null Key Default Extra
a blob NULL YES NULL a blob YES NULL
b text latin1_swedish_ci YES NULL b text YES NULL
c blob NULL YES NULL c blob YES NULL
d mediumtext latin1_swedish_ci YES NULL d mediumtext YES NULL
e longtext latin1_swedish_ci YES NULL e longtext 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));
Warnings: Warnings:
Warning 1244 Converting column 'a' from CHAR to TEXT Warning 1244 Converting column 'a' from CHAR to TEXT
Warning 1244 Converting column 'b' from CHAR to BLOB Warning 1244 Converting column 'b' from CHAR to BLOB
Warning 1244 Converting column 'c' from CHAR to TEXT 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 Null Key Default Extra
a text latin1_swedish_ci YES NULL a text YES NULL
b mediumblob NULL YES NULL b mediumblob YES NULL
c longtext latin1_swedish_ci YES NULL c longtext 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;
Table Create Table Table Create Table
......
...@@ -679,7 +679,8 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild, ...@@ -679,7 +679,8 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
List<Item> field_list; List<Item> field_list;
field_list.push_back(new Item_empty_string("Field",NAME_LEN)); field_list.push_back(new Item_empty_string("Field",NAME_LEN));
field_list.push_back(new Item_empty_string("Type",40)); field_list.push_back(new Item_empty_string("Type",40));
field_list.push_back(new Item_empty_string("Collation",40)); if (verbose)
field_list.push_back(new Item_empty_string("Collation",40));
field_list.push_back(new Item_empty_string("Null",1)); field_list.push_back(new Item_empty_string("Null",1));
field_list.push_back(new Item_empty_string("Key",3)); field_list.push_back(new Item_empty_string("Key",3));
field_list.push_back(item=new Item_empty_string("Default",NAME_LEN)); field_list.push_back(item=new Item_empty_string("Default",NAME_LEN));
...@@ -719,7 +720,8 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild, ...@@ -719,7 +720,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->has_charset() ? field->charset()->name : "NULL", if (verbose)
protocol->store(field->has_charset() ? field->charset()->name : "NULL",
system_charset_info); 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 ?
...@@ -1436,8 +1438,8 @@ static bool write_collation(Protocol *protocol, CHARSET_INFO *cs) ...@@ -1436,8 +1438,8 @@ static bool write_collation(Protocol *protocol, CHARSET_INFO *cs)
protocol->store(cs->name, system_charset_info); protocol->store(cs->name, system_charset_info);
protocol->store(cs->csname, system_charset_info); protocol->store(cs->csname, system_charset_info);
protocol->store_short((longlong) cs->number); protocol->store_short((longlong) cs->number);
protocol->store((cs->state & MY_CS_PRIMARY) ? "Y" : "",system_charset_info); protocol->store((cs->state & MY_CS_PRIMARY) ? "Yes" : "",system_charset_info);
protocol->store((cs->state & MY_CS_COMPILED)? "Y" : "",system_charset_info); protocol->store((cs->state & MY_CS_COMPILED)? "Yes" : "",system_charset_info);
protocol->store_short((longlong) cs->strxfrm_multiply); protocol->store_short((longlong) cs->strxfrm_multiply);
return protocol->write(); return protocol->write();
} }
...@@ -1456,8 +1458,8 @@ int mysqld_show_collations(THD *thd, const char *wild) ...@@ -1456,8 +1458,8 @@ int mysqld_show_collations(THD *thd, const char *wild)
field_list.push_back(new Item_empty_string("Collation",30)); field_list.push_back(new Item_empty_string("Collation",30));
field_list.push_back(new Item_empty_string("Charset",30)); field_list.push_back(new Item_empty_string("Charset",30));
field_list.push_back(new Item_return_int("Id",11, FIELD_TYPE_SHORT)); field_list.push_back(new Item_return_int("Id",11, FIELD_TYPE_SHORT));
field_list.push_back(new Item_empty_string("D",30)); field_list.push_back(new Item_empty_string("Default",30));
field_list.push_back(new Item_empty_string("C",30)); field_list.push_back(new Item_empty_string("Compiled",30));
field_list.push_back(new Item_return_int("Sortlen",3, FIELD_TYPE_SHORT)); field_list.push_back(new Item_return_int("Sortlen",3, FIELD_TYPE_SHORT));
if (protocol->send_fields(&field_list, 1)) if (protocol->send_fields(&field_list, 1))
......
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