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));
ALTER TABLE t1 CHANGE NAME NAME CHAR(80) not null;
SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment
GROUP_ID int(10) unsigned binary PRI 0 select,insert,update,references
LANG_ID smallint(5) 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 NULL PRI 0 select,insert,update,references
NAME char(80) latin1_swedish_ci MUL select,insert,update,references
DROP TABLE t1;
create table t1 (n int);
......@@ -157,7 +157,7 @@ alter table t1 rename t2;
alter table t2 rename t1, add c char(10) comment "no comment";
show columns from t1;
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
drop table t1;
create table t1 (a int, b int);
......
......@@ -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;
describe t2;
Field Type Collation Null Key Default Extra
a datetime latin1_swedish_ci 0000-00-00 00:00:00
b time latin1_swedish_ci 00:00:00
c date latin1_swedish_ci 0000-00-00
d bigint(17) binary 0
e double(18,1) binary 0.0
f bigint(17) binary 0
a datetime NULL 0000-00-00 00:00:00
b time NULL 00:00:00
c date NULL 0000-00-00
d bigint(17) NULL 0
e double(18,1) NULL 0.0
f bigint(17) NULL 0
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;
describe t2;
Field Type Collation Null Key Default Extra
d date latin1_swedish_ci 0000-00-00
t time latin1_swedish_ci 00:00:00
dt datetime latin1_swedish_ci 0000-00-00 00:00:00
d date NULL 0000-00-00
t time NULL 00:00:00
dt datetime NULL 0000-00-00 00:00:00
drop table t1,t2;
create table t1 (a tinyint);
create table t2 (a int) select * from t1;
describe t1;
Field Type Collation Null Key Default Extra
a tinyint(4) binary YES NULL
a tinyint(4) NULL YES NULL
describe t2;
Field Type Collation Null Key Default Extra
a int(11) binary YES NULL
a int(11) NULL YES NULL
drop table if exists t2;
create table t2 (a int, a float) select * from t1;
Duplicate column name 'a'
......
......@@ -500,7 +500,7 @@ t1 CREATE TABLE `t1` (
) TYPE=MyISAM CHARSET=latin1
SHOW FIELDS FROM t1;
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;
SHOW CREATE TABLE t1;
Table Create Table
......
......@@ -14,7 +14,7 @@ Table Create Table
) TYPE=MyISAM CHARSET=latin1
SHOW FIELDS FROM ;
Field Type Collation Null Key Default Extra
char(32) character set koi8r koi8r_general_ci
char(32) koi8r_general_ci
SET CHARACTER SET cp1251;
SHOW TABLES;
Tables_in_test
......@@ -26,7 +26,7 @@ Table Create Table
) TYPE=MyISAM CHARSET=latin1
SHOW FIELDS FROM ;
Field Type Collation Null Key Default Extra
char(32) character set koi8r koi8r_general_ci
char(32) koi8r_general_ci
SET CHARACTER SET utf8;
SHOW TABLES;
Tables_in_test
......@@ -38,7 +38,7 @@ Table Create Table
) TYPE=MyISAM CHARSET=latin1
SHOW FIELDS FROM таблица;
Field Type Collation Null Key Default Extra
поле char(32) character set koi8r koi8r_general_ci
поле char(32) koi8r_general_ci
SET CHARACTER SET koi8r;
DROP TABLE ;
SET CHARACTER SET default;
......@@ -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);
SHOW FIELDS FROM pt;
Field Type Collation Null Key Default Extra
fid int(11) binary PRI 0
g point binary YES NULL
fid int(11) NULL PRI 0
g point NULL YES NULL
SHOW FIELDS FROM ls;
Field Type Collation Null Key Default Extra
fid int(11) binary PRI 0
g linestring binary YES NULL
fid int(11) NULL PRI 0
g linestring NULL YES NULL
SHOW FIELDS FROM p;
Field Type Collation Null Key Default Extra
fid int(11) binary PRI 0
g polygon binary YES NULL
fid int(11) NULL PRI 0
g polygon NULL YES NULL
SHOW FIELDS FROM mpt;
Field Type Collation Null Key Default Extra
fid int(11) binary PRI 0
g multipoint binary YES NULL
fid int(11) NULL PRI 0
g multipoint NULL YES NULL
SHOW FIELDS FROM mls;
Field Type Collation Null Key Default Extra
fid int(11) binary PRI 0
g multilinestring binary YES NULL
fid int(11) NULL PRI 0
g multilinestring NULL YES NULL
SHOW FIELDS FROM mp;
Field Type Collation Null Key Default Extra
fid int(11) binary PRI 0
g multipolygon binary YES NULL
fid int(11) NULL PRI 0
g multipolygon NULL YES NULL
SHOW FIELDS FROM gc;
Field Type Collation Null Key Default Extra
fid int(11) binary PRI 0
g geometrycollection binary YES NULL
fid int(11) NULL PRI 0
g geometrycollection NULL YES NULL
SHOW FIELDS FROM geo;
Field Type Collation Null Key Default Extra
fid int(11) binary PRI 0
g geometry binary YES NULL
fid int(11) NULL PRI 0
g geometry NULL YES NULL
INSERT INTO pt VALUES
(101, PointFromText('POINT(10 10)')),
(102, PointFromText('POINT(20 10)')),
......@@ -367,26 +367,26 @@ gm geometry
);
SHOW FIELDS FROM g1;
Field Type Collation Null Key Default Extra
pt point binary YES NULL
ln linestring binary YES NULL
pg polygon binary YES NULL
mpt multipoint binary YES NULL
mln multilinestring binary YES NULL
mpg multipolygon binary YES NULL
gc geometrycollection binary YES NULL
gm geometry binary YES NULL
pt point NULL YES NULL
ln linestring NULL YES NULL
pg polygon NULL YES NULL
mpt multipoint NULL YES NULL
mln multilinestring NULL YES NULL
mpg multipolygon NULL YES NULL
gc geometrycollection NULL YES NULL
gm geometry NULL YES NULL
ALTER TABLE g1 ADD fid INT NOT NULL;
SHOW FIELDS FROM g1;
Field Type Collation Null Key Default Extra
pt point binary YES NULL
ln linestring binary YES NULL
pg polygon binary YES NULL
mpt multipoint binary YES NULL
mln multilinestring binary YES NULL
mpg multipolygon binary YES NULL
gc geometrycollection binary YES NULL
gm geometry binary YES NULL
fid int(11) binary 0
pt point NULL YES NULL
ln linestring NULL YES NULL
pg polygon NULL YES NULL
mpt multipoint NULL YES NULL
mln multilinestring NULL YES NULL
mpg multipolygon NULL YES NULL
gc geometrycollection NULL YES NULL
gm geometry NULL YES NULL
fid int(11) NULL 0
DROP TABLE g1;
SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))
......
......@@ -907,7 +907,7 @@ drop table t1;
create table t1 (t int not null default 1, key (t)) type=innodb;
desc t1;
Field Type Collation Null Key Default Extra
t int(11) binary MUL 1
t int(11) NULL MUL 1
drop table t1;
CREATE TABLE t1 (
number bigint(20) NOT NULL default '0',
......
......@@ -3218,16 +3218,16 @@ show tables from test like "t?";
Tables_in_test (t?)
show full columns from t2;
Field Type Collation Null Key Default Extra Privileges Comment
auto int(11) binary PRI NULL auto_increment select,insert,update,references
fld1 int(6) unsigned zerofill binary UNI 000000 select,insert,update,references
companynr tinyint(2) unsigned zerofill binary 00 select,insert,update,references
auto int(11) NULL PRI NULL auto_increment select,insert,update,references
fld1 int(6) unsigned zerofill NULL UNI 000000 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
fld4 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
show full columns from t2 from test like 'f%';
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
fld4 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;
Field Type Collation Null Key Default Extra Privileges Comment
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
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;
create table t1 (a int not null, unique aa (a));
show create 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));
show columns from t1;
Field Type Collation Null Key Default Extra
a decimal(9,2) binary YES NULL
b decimal(9,0) binary YES NULL
e double(9,2) binary YES NULL
f double(5,0) binary YES NULL
h float(3,2) binary YES NULL
i float(3,0) binary YES NULL
a decimal(9,2) NULL YES NULL
b decimal(9,0) NULL YES NULL
e double(9,2) NULL YES NULL
f double(5,0) NULL YES NULL
h float(3,2) NULL YES NULL
i float(3,0) NULL YES NULL
show full columns from t1;
Field Type Collation Null Key Default Extra Privileges Comment
a decimal(9,2) binary YES NULL select,insert,update,references
b decimal(9,0) binary YES NULL select,insert,update,references
e double(9,2) binary YES NULL select,insert,update,references
f double(5,0) binary YES NULL select,insert,update,references
h float(3,2) binary YES NULL select,insert,update,references
i float(3,0) binary YES NULL select,insert,update,references
a decimal(9,2) NULL YES NULL select,insert,update,references
b decimal(9,0) NULL YES NULL select,insert,update,references
e double(9,2) NULL YES NULL select,insert,update,references
f double(5,0) NULL YES NULL select,insert,update,references
h float(3,2) NULL YES NULL select,insert,update,references
i float(3,0) NULL YES NULL select,insert,update,references
drop table t1;
create table t1 (
type_bool bool not null,
......@@ -230,15 +230,15 @@ drop table t1;
create table t1 (c decimal, d double, f float, r real);
show columns from t1;
Field Type Collation Null Key Default Extra
c decimal(10,0) binary YES NULL
d double binary YES NULL
f float binary YES NULL
r double binary YES NULL
c decimal(10,0) NULL YES NULL
d double NULL YES NULL
f float NULL YES NULL
r double NULL YES NULL
drop table t1;
create table t1 (c decimal(3,3), d double(3,3), f float(3,3));
show columns from t1;
Field Type Collation Null Key Default Extra
c decimal(4,3) binary YES NULL
d double(4,3) binary YES NULL
f float(4,3) binary YES NULL
c decimal(4,3) NULL YES NULL
d double(4,3) NULL YES NULL
f float(4,3) NULL YES NULL
drop table t1;
......@@ -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));
show columns from t1;
Field Type Collation Null Key Default Extra
a blob binary YES NULL
a blob NULL 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
e longtext latin1_swedish_ci YES NULL
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
show columns from t2;
Field Type Collation Null Key Default Extra
a text latin1_swedish_ci YES NULL
b mediumblob binary YES NULL
b mediumblob NULL YES NULL
c longtext latin1_swedish_ci YES NULL
create table t3 (a long, b long byte);
show create TABLE t3;
......@@ -72,15 +72,15 @@ show full fields from t1;
Field Type Collation Null Key Default Extra Privileges Comment
t text 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
d varchar(10) binary binary YES NULL select,insert,update,references
b blob NULL YES NULL select,insert,update,references
d varchar(10) binary YES NULL select,insert,update,references
lock tables t1 WRITE;
show full fields from t1;
Field Type Collation Null Key Default Extra Privileges Comment
t text 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
d varchar(10) binary binary YES NULL select,insert,update,references
b blob NULL YES NULL select,insert,update,references
d varchar(10) binary YES NULL select,insert,update,references
unlock tables;
select t from t1 where t like "hello";
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;
create table t1 (f1 float(24),f2 float(52));
show full columns from t1;
Field Type Collation Null Key Default Extra Privileges Comment
f1 float binary YES NULL select,insert,update,references
f2 double binary YES NULL select,insert,update,references
f1 float NULL 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);
Warnings:
Warning 1262 Data truncated, out of range for column 'f1' at row 7
......@@ -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));
show full columns from t1;
Field Type Collation Null Key Default Extra Privileges Comment
f float binary YES NULL select,insert,update,references
f2 float binary YES NULL select,insert,update,references
f3 float(6,2) binary YES NULL select,insert,update,references
d double binary YES NULL select,insert,update,references
d2 double binary YES NULL select,insert,update,references
d3 double(10,3) binary YES NULL select,insert,update,references
de decimal(10,0) binary YES NULL select,insert,update,references
de2 decimal(6,0) binary YES NULL select,insert,update,references
de3 decimal(5,2) binary YES NULL select,insert,update,references
n decimal(10,0) binary YES NULL select,insert,update,references
n2 decimal(8,0) binary YES NULL select,insert,update,references
n3 decimal(7,6) binary YES NULL select,insert,update,references
f float NULL YES NULL select,insert,update,references
f2 float NULL YES NULL select,insert,update,references
f3 float(6,2) NULL YES NULL select,insert,update,references
d double NULL YES NULL select,insert,update,references
d2 double NULL YES NULL select,insert,update,references
d3 double(10,3) NULL YES NULL select,insert,update,references
de decimal(10,0) NULL YES NULL select,insert,update,references
de2 decimal(6,0) NULL YES NULL select,insert,update,references
de3 decimal(5,2) NULL YES NULL select,insert,update,references
n decimal(10,0) NULL YES NULL select,insert,update,references
n2 decimal(8,0) NULL YES NULL select,insert,update,references
n3 decimal(7,6) NULL YES NULL select,insert,update,references
drop table t1;
create table t1 (a decimal(7,3) not null, key (a));
insert into t1 values ("0"),("-0.00"),("-0.01"),("-0.002"),("1");
......
......@@ -39,28 +39,28 @@ KEY (options,flags)
);
show full fields from t1;
Field Type Collation Null Key Default Extra Privileges Comment
auto int(5) unsigned binary PRI NULL auto_increment select,insert,update,references
auto int(5) unsigned NULL PRI NULL auto_increment select,insert,update,references
string varchar(10) latin1_swedish_ci YES hello select,insert,update,references
tiny tinyint(4) binary MUL 0 select,insert,update,references
short smallint(6) binary MUL 1 select,insert,update,references
medium mediumint(8) binary MUL 0 select,insert,update,references
long_int int(11) binary 0 select,insert,update,references
longlong bigint(13) binary MUL 0 select,insert,update,references
real_float float(13,1) binary MUL 0.0 select,insert,update,references
real_double double(16,4) binary YES NULL select,insert,update,references
utiny tinyint(3) unsigned binary MUL 0 select,insert,update,references
ushort smallint(5) unsigned zerofill binary MUL 00000 select,insert,update,references
umedium mediumint(8) unsigned binary MUL 0 select,insert,update,references
ulong int(11) unsigned binary MUL 0 select,insert,update,references
ulonglong bigint(13) unsigned binary MUL 0 select,insert,update,references
time_stamp timestamp latin1_swedish_ci YES NULL select,insert,update,references
date_field date latin1_swedish_ci YES NULL select,insert,update,references
time_field time latin1_swedish_ci YES NULL select,insert,update,references
date_time datetime latin1_swedish_ci YES NULL select,insert,update,references
blob_col blob binary YES NULL select,insert,update,references
tinyblob_col tinyblob binary YES NULL select,insert,update,references
mediumblob_col mediumblob binary select,insert,update,references
longblob_col longblob binary select,insert,update,references
tiny tinyint(4) NULL MUL 0 select,insert,update,references
short smallint(6) NULL MUL 1 select,insert,update,references
medium mediumint(8) NULL MUL 0 select,insert,update,references
long_int int(11) NULL 0 select,insert,update,references
longlong bigint(13) NULL MUL 0 select,insert,update,references
real_float float(13,1) NULL MUL 0.0 select,insert,update,references
real_double double(16,4) NULL YES NULL select,insert,update,references
utiny tinyint(3) unsigned NULL MUL 0 select,insert,update,references
ushort smallint(5) unsigned zerofill NULL MUL 00000 select,insert,update,references
umedium mediumint(8) unsigned NULL MUL 0 select,insert,update,references
ulong int(11) unsigned NULL MUL 0 select,insert,update,references
ulonglong bigint(13) unsigned NULL MUL 0 select,insert,update,references
time_stamp timestamp NULL YES NULL select,insert,update,references
date_field date NULL YES NULL select,insert,update,references
time_field time NULL YES NULL select,insert,update,references
date_time datetime NULL YES NULL select,insert,update,references
blob_col blob NULL YES NULL select,insert,update,references
tinyblob_col tinyblob NULL YES NULL select,insert,update,references
mediumblob_col mediumblob NULL select,insert,update,references
longblob_col longblob NULL select,insert,update,references
options enum('one','two','tree') latin1_swedish_ci MUL one select,insert,update,references
flags set('one','two','tree') latin1_swedish_ci select,insert,update,references
show keys from t1;
......@@ -206,53 +206,53 @@ Warning 1263 Data truncated for column 'options' at row 6
update t2 set string="changed" where auto=16;
show full columns from t1;
Field Type Collation Null Key Default Extra Privileges Comment
auto int(5) unsigned binary MUL NULL auto_increment select,insert,update,references
auto int(5) unsigned NULL MUL NULL auto_increment select,insert,update,references
string varchar(10) latin1_swedish_ci YES new defaul select,insert,update,references
tiny tinyint(4) binary MUL 0 select,insert,update,references
short smallint(6) binary MUL 0 select,insert,update,references
medium mediumint(8) binary MUL 0 select,insert,update,references
long_int int(11) binary 0 select,insert,update,references
longlong bigint(13) binary MUL 0 select,insert,update,references
real_float float(13,1) binary MUL 0.0 select,insert,update,references
real_double double(16,4) binary YES NULL select,insert,update,references
utiny tinyint(3) unsigned binary 0 select,insert,update,references
ushort smallint(5) unsigned zerofill binary 00000 select,insert,update,references
umedium mediumint(8) unsigned binary MUL 0 select,insert,update,references
ulong int(11) unsigned binary MUL 0 select,insert,update,references
ulonglong bigint(13) unsigned binary MUL 0 select,insert,update,references
time_stamp timestamp latin1_swedish_ci YES NULL select,insert,update,references
tiny tinyint(4) NULL MUL 0 select,insert,update,references
short smallint(6) NULL MUL 0 select,insert,update,references
medium mediumint(8) NULL MUL 0 select,insert,update,references
long_int int(11) NULL 0 select,insert,update,references
longlong bigint(13) NULL MUL 0 select,insert,update,references
real_float float(13,1) NULL MUL 0.0 select,insert,update,references
real_double double(16,4) NULL YES NULL select,insert,update,references
utiny tinyint(3) unsigned NULL 0 select,insert,update,references
ushort smallint(5) unsigned zerofill NULL 00000 select,insert,update,references
umedium mediumint(8) unsigned NULL MUL 0 select,insert,update,references
ulong int(11) unsigned NULL MUL 0 select,insert,update,references
ulonglong bigint(13) unsigned NULL MUL 0 select,insert,update,references
time_stamp timestamp NULL YES NULL select,insert,update,references
date_field varchar(10) latin1_swedish_ci YES NULL select,insert,update,references
time_field time latin1_swedish_ci YES NULL select,insert,update,references
date_time datetime latin1_swedish_ci YES NULL select,insert,update,references
time_field time NULL YES NULL select,insert,update,references
date_time datetime NULL YES NULL select,insert,update,references
new_blob_col varchar(20) latin1_swedish_ci YES NULL select,insert,update,references
tinyblob_col tinyblob binary YES NULL select,insert,update,references
mediumblob_col mediumblob binary select,insert,update,references
tinyblob_col tinyblob NULL YES NULL select,insert,update,references
mediumblob_col mediumblob NULL select,insert,update,references
options enum('one','two','tree') latin1_swedish_ci MUL one select,insert,update,references
flags set('one','two','tree') latin1_swedish_ci select,insert,update,references
new_field varchar(10) latin1_swedish_ci new select,insert,update,references
show full columns from t2;
Field Type Collation Null Key Default Extra Privileges Comment
auto int(5) unsigned binary 0 select,insert,update,references
auto int(5) unsigned NULL 0 select,insert,update,references
string varchar(10) latin1_swedish_ci YES new defaul select,insert,update,references
tiny tinyint(4) binary 0 select,insert,update,references
short smallint(6) binary 0 select,insert,update,references
medium mediumint(8) binary 0 select,insert,update,references
long_int int(11) binary 0 select,insert,update,references
longlong bigint(13) binary 0 select,insert,update,references
real_float float(13,1) binary 0.0 select,insert,update,references
real_double double(16,4) binary YES NULL select,insert,update,references
utiny tinyint(3) unsigned binary 0 select,insert,update,references
ushort smallint(5) unsigned zerofill binary 00000 select,insert,update,references
umedium mediumint(8) unsigned binary 0 select,insert,update,references
ulong int(11) unsigned binary 0 select,insert,update,references
ulonglong bigint(13) unsigned binary 0 select,insert,update,references
time_stamp timestamp latin1_swedish_ci YES NULL select,insert,update,references
tiny tinyint(4) NULL 0 select,insert,update,references
short smallint(6) NULL 0 select,insert,update,references
medium mediumint(8) NULL 0 select,insert,update,references
long_int int(11) NULL 0 select,insert,update,references
longlong bigint(13) NULL 0 select,insert,update,references
real_float float(13,1) NULL 0.0 select,insert,update,references
real_double double(16,4) NULL YES NULL select,insert,update,references
utiny tinyint(3) unsigned NULL 0 select,insert,update,references
ushort smallint(5) unsigned zerofill NULL 00000 select,insert,update,references
umedium mediumint(8) unsigned NULL 0 select,insert,update,references
ulong int(11) unsigned NULL 0 select,insert,update,references
ulonglong bigint(13) unsigned NULL 0 select,insert,update,references
time_stamp timestamp NULL YES NULL select,insert,update,references
date_field varchar(10) latin1_swedish_ci YES NULL select,insert,update,references
time_field time latin1_swedish_ci YES NULL select,insert,update,references
date_time datetime latin1_swedish_ci YES NULL select,insert,update,references
time_field time NULL YES NULL select,insert,update,references
date_time datetime NULL YES NULL select,insert,update,references
new_blob_col varchar(20) latin1_swedish_ci YES NULL select,insert,update,references
tinyblob_col tinyblob binary YES NULL select,insert,update,references
mediumblob_col mediumblob binary select,insert,update,references
tinyblob_col tinyblob NULL YES NULL select,insert,update,references
mediumblob_col mediumblob NULL select,insert,update,references
options enum('one','two','tree') latin1_swedish_ci one select,insert,update,references
flags set('one','two','tree') latin1_swedish_ci select,insert,update,references
new_field varchar(10) latin1_swedish_ci new select,insert,update,references
......@@ -266,11 +266,11 @@ drop table t2;
create table t2 (primary key (auto)) select auto+1 as auto,1 as t1, "a" as t2, repeat("a",256) as t3, binary repeat("b",256) as t4 from t1;
show full columns from t2;
Field Type Collation Null Key Default Extra Privileges Comment
auto bigint(17) unsigned binary PRI 0 select,insert,update,references
t1 bigint(1) binary 0 select,insert,update,references
auto bigint(17) unsigned NULL PRI 0 select,insert,update,references
t1 bigint(1) NULL 0 select,insert,update,references
t2 char(1) latin1_swedish_ci select,insert,update,references
t3 mediumtext latin1_swedish_ci select,insert,update,references
t4 mediumtext character set latin1 latin1_bin select,insert,update,references
t4 mediumtext latin1_bin select,insert,update,references
select * from t2;
auto t1 t2 t3 t4
11 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
......@@ -289,9 +289,9 @@ Duplicate column name 'c'
create table t3 select t1.c AS c1, t2.c AS c2,1 as "const" from t1, t2;
show full columns from t3;
Field Type Collation Null Key Default Extra Privileges Comment
c1 int(11) binary YES NULL select,insert,update,references
c2 int(11) binary YES NULL select,insert,update,references
const bigint(1) binary 0 select,insert,update,references
c1 int(11) NULL YES NULL select,insert,update,references
c2 int(11) NULL YES NULL select,insert,update,references
const bigint(1) NULL 0 select,insert,update,references
drop table t1,t2,t3;
create table t1 ( myfield INT NOT NULL, UNIQUE INDEX (myfield), unique (myfield), index(myfield));
drop table t1;
......
......@@ -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)
{
copy->str=ptr;
......@@ -4027,7 +4007,6 @@ void Field_string::sql_type(String &res) const
"varchar" : "char"),
(int) field_length);
res.length(length);
add_binary_or_charset(res);
}
......@@ -4194,7 +4173,6 @@ void Field_varstring::sql_type(String &res) const
res.alloced_length(),"varchar(%u)",
field_length);
res.length(length);
add_binary_or_charset(res);
}
char *Field_varstring::pack(char *to, const char *from, uint max_length)
......@@ -4640,11 +4618,6 @@ void Field_blob::sql_type(String &res) const
else
{
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
flag=1;
}
res.append(')');
add_binary_or_charset(res);
}
......@@ -5243,7 +5215,6 @@ void Field_set::sql_type(String &res) const
flag=1;
}
res.append(')');
add_binary_or_charset(res);
}
/* returns 1 if the fields are equally defined */
......
......@@ -211,6 +211,7 @@ class Field
virtual bool get_date(TIME *ltime,bool fuzzydate);
virtual bool get_time(TIME *ltime);
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_warning(const unsigned int level,
const unsigned int code);
......@@ -277,12 +278,10 @@ class Field_str :public Field {
flags|=BINARY_FLAG;
}
Item_result result_type () const { return STRING_RESULT; }
void add_binary_or_charset(String &res) const;
uint decimals() const { return NOT_FIXED_DEC; }
void make_field(Send_field *);
uint size_of() const { return sizeof(*this); }
CHARSET_INFO *charset(void) const { return field_charset; }
void set_charset(CHARSET_INFO *charset) { field_charset=charset; }
bool binary() const { return field_charset->state & MY_CS_BINSORT ? 1 : 0; }
friend class create_field;
......@@ -807,6 +806,7 @@ class Field_string :public Field_str {
uint max_packed_col_length(uint max_length);
uint size_of() const { return sizeof(*this); }
enum_field_types real_type() const { return FIELD_TYPE_STRING; }
bool has_charset(void) const { return TRUE; }
};
......@@ -849,6 +849,7 @@ class Field_varstring :public Field_str {
uint max_packed_col_length(uint max_length);
uint size_of() const { return sizeof(*this); }
enum_field_types real_type() const { return FIELD_TYPE_VAR_STRING; }
bool has_charset(void) const { return TRUE; }
};
......@@ -936,6 +937,8 @@ class Field_blob :public Field_str {
inline void clear_temporary() { bzero((char*) &value,sizeof(value)); }
friend void field_conv(Field *to,Field *from);
uint size_of() const { return sizeof(*this); }
bool has_charset(void) const
{ return charset() == &my_charset_bin ? FALSE : TRUE; }
};
......@@ -1004,6 +1007,7 @@ class Field_enum :public Field_str {
virtual bool zero_pack() const { return 0; }
bool optimize_range(uint idx) { return 0; }
bool eq_def(Field *field);
bool has_charset(void) const { return TRUE; }
};
......@@ -1028,6 +1032,7 @@ class Field_set :public Field_enum {
String *val_str(String*,String *);
void sql_type(String &str) const;
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,
protocol->store(field->field_name, system_charset_info);
field->sql_type(type);
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) &&
field->type() != FIELD_TYPE_TIMESTAMP ?
"" : "YES");
......@@ -1073,23 +1073,36 @@ store_create_info(THD *thd, TABLE *table, String *packet)
field->sql_type(type);
packet->append(type.ptr(),type.length());
bool has_default = (field->type() != FIELD_TYPE_BLOB &&
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)
if (field->has_charset())
{
packet->append(" collate ", 9);
packet->append(field->charset()->name);
if (field->charset() == &my_charset_bin)
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)
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)
{
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