mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Separating CHARSET and COLLATION terms
This commit is contained in:
@ -50,10 +50,10 @@ PRIMARY KEY (GROUP_ID,LANG_ID),
|
||||
KEY NAME (NAME));
|
||||
ALTER TABLE t1 CHANGE NAME NAME CHAR(80) not null;
|
||||
SHOW FULL COLUMNS FROM t1;
|
||||
Field Type Null Key Default Extra Privileges Comment
|
||||
GROUP_ID int(10) unsigned PRI 0 select,insert,update,references
|
||||
LANG_ID smallint(5) unsigned PRI 0 select,insert,update,references
|
||||
NAME char(80) character set latin1 MUL select,insert,update,references
|
||||
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
|
||||
NAME char(80) character set latin1 latin1 MUL select,insert,update,references
|
||||
DROP TABLE t1;
|
||||
create table t1 (n int);
|
||||
insert into t1 values(9),(3),(12),(10);
|
||||
@ -118,7 +118,7 @@ create table t1 (i int unsigned not null auto_increment primary key);
|
||||
alter table t1 rename t2;
|
||||
alter table t2 rename t1, add c char(10) comment "no comment";
|
||||
show columns from t1;
|
||||
Field Type Null Key Default Extra
|
||||
i int(10) unsigned PRI NULL auto_increment
|
||||
c char(10) character set latin1 YES NULL
|
||||
Field Type Collation Null Key Default Extra
|
||||
i int(10) unsigned binary PRI NULL auto_increment
|
||||
c char(10) character set latin1 latin1 YES NULL
|
||||
drop table t1;
|
||||
|
@ -75,37 +75,37 @@ drop table t1,t2;
|
||||
create table t1(x varchar(50) );
|
||||
create table t2 select x from t1 where 1=2;
|
||||
describe t1;
|
||||
Field Type Null Key Default Extra
|
||||
x varchar(50) character set latin1 YES NULL
|
||||
Field Type Collation Null Key Default Extra
|
||||
x varchar(50) character set latin1 latin1 YES NULL
|
||||
describe t2;
|
||||
Field Type Null Key Default Extra
|
||||
x char(50) character set latin1 YES NULL
|
||||
Field Type Collation Null Key Default Extra
|
||||
x char(50) character set latin1 latin1 YES NULL
|
||||
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 Null Key Default Extra
|
||||
a datetime 0000-00-00 00:00:00
|
||||
b time 00:00:00
|
||||
c date 0000-00-00
|
||||
d bigint(17) 0
|
||||
e double(18,1) 0.0
|
||||
f bigint(17) 0
|
||||
Field Type Collation Null Key Default Extra
|
||||
a datetime latin1 0000-00-00 00:00:00
|
||||
b time latin1 00:00:00
|
||||
c date latin1 0000-00-00
|
||||
d bigint(17) binary 0
|
||||
e double(18,1) binary 0.0
|
||||
f bigint(17) binary 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 Null Key Default Extra
|
||||
d date 0000-00-00
|
||||
t time 00:00:00
|
||||
dt datetime 0000-00-00 00:00:00
|
||||
Field Type Collation Null Key Default Extra
|
||||
d date latin1 0000-00-00
|
||||
t time latin1 00:00:00
|
||||
dt datetime latin1 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 Null Key Default Extra
|
||||
a tinyint(4) YES NULL
|
||||
Field Type Collation Null Key Default Extra
|
||||
a tinyint(4) binary YES NULL
|
||||
describe t2;
|
||||
Field Type Null Key Default Extra
|
||||
a int(11) YES NULL
|
||||
Field Type Collation Null Key Default Extra
|
||||
a int(11) binary YES NULL
|
||||
drop table if exists t2;
|
||||
create table t2 (a int, a float) select * from t1;
|
||||
Duplicate column name 'a'
|
||||
|
@ -918,8 +918,8 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
drop table t1;
|
||||
create table t1 (t int not null default 1, key (t)) type=innodb;
|
||||
desc t1;
|
||||
Field Type Null Key Default Extra
|
||||
t int(11) MUL 1
|
||||
Field Type Collation Null Key Default Extra
|
||||
t int(11) binary MUL 1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
number bigint(20) NOT NULL default '0',
|
||||
|
@ -64,15 +64,15 @@ Table Op Msg_type Msg_text
|
||||
test.t2 check error Table 't2' was not locked with LOCK TABLES
|
||||
test.t1 check status OK
|
||||
show columns from t1;
|
||||
Field Type Null Key Default Extra
|
||||
a int(11) PRI 0
|
||||
b int(11) MUL 0
|
||||
c int(11) 0
|
||||
Field Type Collation Null Key Default Extra
|
||||
a int(11) binary PRI 0
|
||||
b int(11) binary MUL 0
|
||||
c int(11) binary 0
|
||||
show full columns from t1;
|
||||
Field Type Null Key Default Extra Privileges Comment
|
||||
a int(11) PRI 0 select,insert,update,references
|
||||
b int(11) MUL 0 select,insert,update,references
|
||||
c int(11) 0 select,insert,update,references
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
a int(11) binary PRI 0 select,insert,update,references
|
||||
b int(11) binary MUL 0 select,insert,update,references
|
||||
c int(11) binary 0 select,insert,update,references
|
||||
show index from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 0 PRIMARY 1 a A 4 NULL NULL BTREE
|
||||
|
@ -3217,23 +3217,23 @@ Tables_in_test (s%)
|
||||
show tables from test like "t?";
|
||||
Tables_in_test (t?)
|
||||
show full columns from t2;
|
||||
Field Type Null Key Default Extra Privileges Comment
|
||||
auto int(11) PRI NULL auto_increment select,insert,update,references
|
||||
fld1 int(6) unsigned zerofill UNI 000000 select,insert,update,references
|
||||
companynr tinyint(2) unsigned zerofill 00 select,insert,update,references
|
||||
fld3 char(30) character set latin1 MUL select,insert,update,references
|
||||
fld4 char(35) character set latin1 select,insert,update,references
|
||||
fld5 char(35) character set latin1 select,insert,update,references
|
||||
fld6 char(4) character set latin1 select,insert,update,references
|
||||
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
|
||||
fld3 char(30) character set latin1 latin1 MUL select,insert,update,references
|
||||
fld4 char(35) character set latin1 latin1 select,insert,update,references
|
||||
fld5 char(35) character set latin1 latin1 select,insert,update,references
|
||||
fld6 char(4) character set latin1 latin1 select,insert,update,references
|
||||
show full columns from t2 from test like 'f%';
|
||||
Field Type Null Key Default Extra Privileges Comment
|
||||
fld1 int(6) unsigned zerofill UNI 000000 select,insert,update,references
|
||||
fld3 char(30) character set latin1 MUL select,insert,update,references
|
||||
fld4 char(35) character set latin1 select,insert,update,references
|
||||
fld5 char(35) character set latin1 select,insert,update,references
|
||||
fld6 char(4) character set latin1 select,insert,update,references
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
fld1 int(6) unsigned zerofill binary UNI 000000 select,insert,update,references
|
||||
fld3 char(30) character set latin1 latin1 MUL select,insert,update,references
|
||||
fld4 char(35) character set latin1 latin1 select,insert,update,references
|
||||
fld5 char(35) character set latin1 latin1 select,insert,update,references
|
||||
fld6 char(4) character set latin1 latin1 select,insert,update,references
|
||||
show full columns from t2 from test like 's%';
|
||||
Field Type Null Key Default Extra Privileges Comment
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
show keys from t2;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE
|
||||
|
@ -98,10 +98,10 @@ t1 CREATE TABLE `t1` (
|
||||
`c` int(11) NOT NULL default '0' COMMENT 'int column'
|
||||
) TYPE=MyISAM CHARSET=latin1 COMMENT='it''s a table'
|
||||
show full columns from t1;
|
||||
Field Type Null Key Default Extra Privileges Comment
|
||||
test_set set('val1','val2','val3') character set latin1 select,insert,update,references
|
||||
name char(20) character set latin1 YES O'Brien select,insert,update,references O'Brien as default
|
||||
c int(11) 0 select,insert,update,references int column
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
test_set set('val1','val2','val3') character set latin1 latin1 select,insert,update,references
|
||||
name char(20) character set latin1 latin1 YES O'Brien select,insert,update,references O'Brien as default
|
||||
c int(11) binary 0 select,insert,update,references int column
|
||||
drop table t1;
|
||||
create table t1 (a int not null, unique aa (a));
|
||||
show create table t1;
|
||||
@ -155,34 +155,34 @@ t1 CREATE 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));
|
||||
show columns from t1;
|
||||
Field Type Null Key Default Extra
|
||||
a decimal(9,2) YES NULL
|
||||
b decimal(9,0) YES NULL
|
||||
e double(9,2) YES NULL
|
||||
f double(5,0) YES NULL
|
||||
h float(3,2) YES NULL
|
||||
i float(3,0) YES NULL
|
||||
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
|
||||
show full columns from t1;
|
||||
Field Type Null Key Default Extra Privileges Comment
|
||||
a decimal(9,2) YES NULL select,insert,update,references
|
||||
b decimal(9,0) YES NULL select,insert,update,references
|
||||
e double(9,2) YES NULL select,insert,update,references
|
||||
f double(5,0) YES NULL select,insert,update,references
|
||||
h float(3,2) YES NULL select,insert,update,references
|
||||
i float(3,0) YES NULL select,insert,update,references
|
||||
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
|
||||
drop table t1;
|
||||
create table t1 (c decimal, d double, f float, r real);
|
||||
show columns from t1;
|
||||
Field Type Null Key Default Extra
|
||||
c decimal(10,0) YES NULL
|
||||
d double YES NULL
|
||||
f float YES NULL
|
||||
r double YES NULL
|
||||
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
|
||||
drop table t1;
|
||||
create table t1 (c decimal(3,3), d double(3,3), f float(3,3));
|
||||
show columns from t1;
|
||||
Field Type Null Key Default Extra
|
||||
c decimal(4,3) YES NULL
|
||||
d double(4,3) YES NULL
|
||||
f float(4,3) YES NULL
|
||||
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
|
||||
drop table t1;
|
||||
|
@ -1,22 +1,22 @@
|
||||
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 Null Key Default Extra
|
||||
a blob YES NULL
|
||||
b text character set latin1 YES NULL
|
||||
c blob YES NULL
|
||||
d mediumtext character set latin1 YES NULL
|
||||
e longtext character set latin1 YES NULL
|
||||
Field Type Collation Null Key Default Extra
|
||||
a blob binary YES NULL
|
||||
b text character set latin1 latin1 YES NULL
|
||||
c blob binary YES NULL
|
||||
d mediumtext character set latin1 latin1 YES NULL
|
||||
e longtext character set latin1 latin1 YES NULL
|
||||
CREATE TABLE t2 (a char(257), b varchar(70000) binary, c varchar(70000000));
|
||||
Warnings:
|
||||
Warning 1244 Converting column 'a' from CHAR to TEXT
|
||||
Warning 1244 Converting column 'b' from CHAR to BLOB
|
||||
Warning 1244 Converting column 'c' from CHAR to TEXT
|
||||
show columns from t2;
|
||||
Field Type Null Key Default Extra
|
||||
a text character set latin1 YES NULL
|
||||
b mediumblob YES NULL
|
||||
c longtext character set latin1 YES NULL
|
||||
Field Type Collation Null Key Default Extra
|
||||
a text character set latin1 latin1 YES NULL
|
||||
b mediumblob binary YES NULL
|
||||
c longtext character set latin1 latin1 YES NULL
|
||||
create table t3 (a long, b long byte);
|
||||
show create TABLE t3;
|
||||
Table Create Table
|
||||
@ -69,18 +69,18 @@ insert into t1 values (NULL,NULL,NULL,NULL);
|
||||
update t1 set c="",b=null where c="1";
|
||||
lock tables t1 READ;
|
||||
show full fields from t1;
|
||||
Field Type Null Key Default Extra Privileges Comment
|
||||
t text character set latin1 YES NULL select,insert,update,references
|
||||
c varchar(10) character set latin1 YES NULL select,insert,update,references
|
||||
b blob YES NULL select,insert,update,references
|
||||
d varchar(10) binary YES NULL select,insert,update,references
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
t text character set latin1 latin1 YES NULL select,insert,update,references
|
||||
c varchar(10) character set latin1 latin1 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
|
||||
lock tables t1 WRITE;
|
||||
show full fields from t1;
|
||||
Field Type Null Key Default Extra Privileges Comment
|
||||
t text character set latin1 YES NULL select,insert,update,references
|
||||
c varchar(10) character set latin1 YES NULL select,insert,update,references
|
||||
b blob YES NULL select,insert,update,references
|
||||
d varchar(10) binary YES NULL select,insert,update,references
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
t text character set latin1 latin1 YES NULL select,insert,update,references
|
||||
c varchar(10) character set latin1 latin1 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
|
||||
unlock tables;
|
||||
select t from t1 where t like "hello";
|
||||
t
|
||||
|
@ -10,9 +10,9 @@ SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1;
|
||||
10 10 10 10 10 10 0.1 0.1 0.1
|
||||
create table t1 (f1 float(24),f2 float(52));
|
||||
show full columns from t1;
|
||||
Field Type Null Key Default Extra Privileges Comment
|
||||
f1 float YES NULL select,insert,update,references
|
||||
f2 double YES NULL select,insert,update,references
|
||||
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
|
||||
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),(1e-10,1e-10),(1e-15,1e-15),(1e-20,1e-20),(1e-50,1e-50),(1e-150,1e-150);
|
||||
select * from t1;
|
||||
@ -69,19 +69,19 @@ min(a)
|
||||
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 Null Key Default Extra Privileges Comment
|
||||
f float YES NULL select,insert,update,references
|
||||
f2 float YES NULL select,insert,update,references
|
||||
f3 float(6,2) YES NULL select,insert,update,references
|
||||
d double YES NULL select,insert,update,references
|
||||
d2 double YES NULL select,insert,update,references
|
||||
d3 double(10,3) YES NULL select,insert,update,references
|
||||
de decimal(10,0) YES NULL select,insert,update,references
|
||||
de2 decimal(6,0) YES NULL select,insert,update,references
|
||||
de3 decimal(5,2) YES NULL select,insert,update,references
|
||||
n decimal(10,0) YES NULL select,insert,update,references
|
||||
n2 decimal(8,0) YES NULL select,insert,update,references
|
||||
n3 decimal(7,6) YES NULL select,insert,update,references
|
||||
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
|
||||
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");
|
||||
|
@ -38,31 +38,31 @@ KEY (ulonglong,ulong),
|
||||
KEY (options,flags)
|
||||
);
|
||||
show full fields from t1;
|
||||
Field Type Null Key Default Extra Privileges Comment
|
||||
auto int(5) unsigned PRI NULL auto_increment select,insert,update,references
|
||||
string varchar(10) character set latin1 YES hello select,insert,update,references
|
||||
tiny tinyint(4) MUL 0 select,insert,update,references
|
||||
short smallint(6) MUL 1 select,insert,update,references
|
||||
medium mediumint(8) MUL 0 select,insert,update,references
|
||||
long_int int(11) 0 select,insert,update,references
|
||||
longlong bigint(13) MUL 0 select,insert,update,references
|
||||
real_float float(13,1) MUL 0.0 select,insert,update,references
|
||||
real_double double(16,4) YES NULL select,insert,update,references
|
||||
utiny tinyint(3) unsigned MUL 0 select,insert,update,references
|
||||
ushort smallint(5) unsigned zerofill MUL 00000 select,insert,update,references
|
||||
umedium mediumint(8) unsigned MUL 0 select,insert,update,references
|
||||
ulong int(11) unsigned MUL 0 select,insert,update,references
|
||||
ulonglong bigint(13) unsigned MUL 0 select,insert,update,references
|
||||
time_stamp timestamp YES NULL select,insert,update,references
|
||||
date_field date YES NULL select,insert,update,references
|
||||
time_field time YES NULL select,insert,update,references
|
||||
date_time datetime YES NULL select,insert,update,references
|
||||
blob_col blob YES NULL select,insert,update,references
|
||||
tinyblob_col tinyblob YES NULL select,insert,update,references
|
||||
mediumblob_col mediumblob select,insert,update,references
|
||||
longblob_col longblob select,insert,update,references
|
||||
options enum('one','two','tree') character set latin1 MUL one select,insert,update,references
|
||||
flags set('one','two','tree') character set latin1 select,insert,update,references
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
auto int(5) unsigned binary PRI NULL auto_increment select,insert,update,references
|
||||
string varchar(10) character set latin1 latin1 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 YES NULL select,insert,update,references
|
||||
date_field date latin1 YES NULL select,insert,update,references
|
||||
time_field time latin1 YES NULL select,insert,update,references
|
||||
date_time datetime latin1 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
|
||||
options enum('one','two','tree') character set latin1 latin1 MUL one select,insert,update,references
|
||||
flags set('one','two','tree') character set latin1 latin1 select,insert,update,references
|
||||
show keys from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 0 PRIMARY 1 auto A 0 NULL NULL BTREE
|
||||
@ -168,57 +168,57 @@ drop table t2;
|
||||
create table t2 select * from t1;
|
||||
update t2 set string="changed" where auto=16;
|
||||
show full columns from t1;
|
||||
Field Type Null Key Default Extra Privileges Comment
|
||||
auto int(5) unsigned MUL NULL auto_increment select,insert,update,references
|
||||
string varchar(10) character set latin1 YES new defaul select,insert,update,references
|
||||
tiny tinyint(4) MUL 0 select,insert,update,references
|
||||
short smallint(6) MUL 0 select,insert,update,references
|
||||
medium mediumint(8) MUL 0 select,insert,update,references
|
||||
long_int int(11) 0 select,insert,update,references
|
||||
longlong bigint(13) MUL 0 select,insert,update,references
|
||||
real_float float(13,1) MUL 0.0 select,insert,update,references
|
||||
real_double double(16,4) YES NULL select,insert,update,references
|
||||
utiny tinyint(3) unsigned 0 select,insert,update,references
|
||||
ushort smallint(5) unsigned zerofill 00000 select,insert,update,references
|
||||
umedium mediumint(8) unsigned MUL 0 select,insert,update,references
|
||||
ulong int(11) unsigned MUL 0 select,insert,update,references
|
||||
ulonglong bigint(13) unsigned MUL 0 select,insert,update,references
|
||||
time_stamp timestamp YES NULL select,insert,update,references
|
||||
date_field varchar(10) character set latin1 YES NULL select,insert,update,references
|
||||
time_field time YES NULL select,insert,update,references
|
||||
date_time datetime YES NULL select,insert,update,references
|
||||
new_blob_col varchar(20) character set latin1 YES NULL select,insert,update,references
|
||||
tinyblob_col tinyblob YES NULL select,insert,update,references
|
||||
mediumblob_col mediumblob select,insert,update,references
|
||||
options enum('one','two','tree') character set latin1 MUL one select,insert,update,references
|
||||
flags set('one','two','tree') character set latin1 select,insert,update,references
|
||||
new_field varchar(10) character set latin1 new select,insert,update,references
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
auto int(5) unsigned binary MUL NULL auto_increment select,insert,update,references
|
||||
string varchar(10) character set latin1 latin1 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 YES NULL select,insert,update,references
|
||||
date_field varchar(10) character set latin1 latin1 YES NULL select,insert,update,references
|
||||
time_field time latin1 YES NULL select,insert,update,references
|
||||
date_time datetime latin1 YES NULL select,insert,update,references
|
||||
new_blob_col varchar(20) character set latin1 latin1 YES NULL select,insert,update,references
|
||||
tinyblob_col tinyblob binary YES NULL select,insert,update,references
|
||||
mediumblob_col mediumblob binary select,insert,update,references
|
||||
options enum('one','two','tree') character set latin1 latin1 MUL one select,insert,update,references
|
||||
flags set('one','two','tree') character set latin1 latin1 select,insert,update,references
|
||||
new_field varchar(10) character set latin1 latin1 new select,insert,update,references
|
||||
show full columns from t2;
|
||||
Field Type Null Key Default Extra Privileges Comment
|
||||
auto int(5) unsigned 0 select,insert,update,references
|
||||
string varchar(10) character set latin1 YES new defaul select,insert,update,references
|
||||
tiny tinyint(4) 0 select,insert,update,references
|
||||
short smallint(6) 0 select,insert,update,references
|
||||
medium mediumint(8) 0 select,insert,update,references
|
||||
long_int int(11) 0 select,insert,update,references
|
||||
longlong bigint(13) 0 select,insert,update,references
|
||||
real_float float(13,1) 0.0 select,insert,update,references
|
||||
real_double double(16,4) YES NULL select,insert,update,references
|
||||
utiny tinyint(3) unsigned 0 select,insert,update,references
|
||||
ushort smallint(5) unsigned zerofill 00000 select,insert,update,references
|
||||
umedium mediumint(8) unsigned 0 select,insert,update,references
|
||||
ulong int(11) unsigned 0 select,insert,update,references
|
||||
ulonglong bigint(13) unsigned 0 select,insert,update,references
|
||||
time_stamp timestamp YES NULL select,insert,update,references
|
||||
date_field varchar(10) character set latin1 YES NULL select,insert,update,references
|
||||
time_field time YES NULL select,insert,update,references
|
||||
date_time datetime YES NULL select,insert,update,references
|
||||
new_blob_col varchar(20) character set latin1 YES NULL select,insert,update,references
|
||||
tinyblob_col tinyblob YES NULL select,insert,update,references
|
||||
mediumblob_col mediumblob select,insert,update,references
|
||||
options enum('one','two','tree') character set latin1 one select,insert,update,references
|
||||
flags set('one','two','tree') character set latin1 select,insert,update,references
|
||||
new_field varchar(10) character set latin1 new select,insert,update,references
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
auto int(5) unsigned binary 0 select,insert,update,references
|
||||
string varchar(10) character set latin1 latin1 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 YES NULL select,insert,update,references
|
||||
date_field varchar(10) character set latin1 latin1 YES NULL select,insert,update,references
|
||||
time_field time latin1 YES NULL select,insert,update,references
|
||||
date_time datetime latin1 YES NULL select,insert,update,references
|
||||
new_blob_col varchar(20) character set latin1 latin1 YES NULL select,insert,update,references
|
||||
tinyblob_col tinyblob binary YES NULL select,insert,update,references
|
||||
mediumblob_col mediumblob binary select,insert,update,references
|
||||
options enum('one','two','tree') character set latin1 latin1 one select,insert,update,references
|
||||
flags set('one','two','tree') character set latin1 latin1 select,insert,update,references
|
||||
new_field varchar(10) character set latin1 latin1 new select,insert,update,references
|
||||
select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and ((t1.string<>t2.string and (t1.string is not null or t2.string is not null)) or (t1.tiny<>t2.tiny and (t1.tiny is not null or t2.tiny is not null)) or (t1.short<>t2.short and (t1.short is not null or t2.short is not null)) or (t1.medium<>t2.medium and (t1.medium is not null or t2.medium is not null)) or (t1.long_int<>t2.long_int and (t1.long_int is not null or t2.long_int is not null)) or (t1.longlong<>t2.longlong and (t1.longlong is not null or t2.longlong is not null)) or (t1.real_float<>t2.real_float and (t1.real_float is not null or t2.real_float is not null)) or (t1.real_double<>t2.real_double and (t1.real_double is not null or t2.real_double is not null)) or (t1.utiny<>t2.utiny and (t1.utiny is not null or t2.utiny is not null)) or (t1.ushort<>t2.ushort and (t1.ushort is not null or t2.ushort is not null)) or (t1.umedium<>t2.umedium and (t1.umedium is not null or t2.umedium is not null)) or (t1.ulong<>t2.ulong and (t1.ulong is not null or t2.ulong is not null)) or (t1.ulonglong<>t2.ulonglong and (t1.ulonglong is not null or t2.ulonglong is not null)) or (t1.time_stamp<>t2.time_stamp and (t1.time_stamp is not null or t2.time_stamp is not null)) or (t1.date_field<>t2.date_field and (t1.date_field is not null or t2.date_field is not null)) or (t1.time_field<>t2.time_field and (t1.time_field is not null or t2.time_field is not null)) or (t1.date_time<>t2.date_time and (t1.date_time is not null or t2.date_time is not null)) or (t1.new_blob_col<>t2.new_blob_col and (t1.new_blob_col is not null or t2.new_blob_col is not null)) or (t1.tinyblob_col<>t2.tinyblob_col and (t1.tinyblob_col is not null or t2.tinyblob_col is not null)) or (t1.mediumblob_col<>t2.mediumblob_col and (t1.mediumblob_col is not null or t2.mediumblob_col is not null)) or (t1.options<>t2.options and (t1.options is not null or t2.options is not null)) or (t1.flags<>t2.flags and (t1.flags is not null or t2.flags is not null)) or (t1.new_field<>t2.new_field and (t1.new_field is not null or t2.new_field is not null)));
|
||||
auto auto
|
||||
16 16
|
||||
@ -228,12 +228,12 @@ auto auto
|
||||
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 Null Key Default Extra Privileges Comment
|
||||
auto bigint(17) unsigned PRI 0 select,insert,update,references
|
||||
t1 bigint(1) 0 select,insert,update,references
|
||||
t2 char(1) character set latin1 select,insert,update,references
|
||||
t3 mediumtext character set latin1 select,insert,update,references
|
||||
t4 mediumblob select,insert,update,references
|
||||
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
|
||||
t2 char(1) character set latin1 latin1 select,insert,update,references
|
||||
t3 mediumtext character set latin1 latin1 select,insert,update,references
|
||||
t4 mediumblob binary select,insert,update,references
|
||||
select * from t2;
|
||||
auto t1 t2 t3 t4
|
||||
11 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
@ -251,10 +251,10 @@ create table t3 select * from t1, t2;
|
||||
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 Null Key Default Extra Privileges Comment
|
||||
c1 int(11) YES NULL select,insert,update,references
|
||||
c2 int(11) YES NULL select,insert,update,references
|
||||
const bigint(1) 0 select,insert,update,references
|
||||
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
|
||||
drop table t1,t2,t3;
|
||||
create table t1 ( myfield INT NOT NULL, UNIQUE INDEX (myfield), unique (myfield), index(myfield));
|
||||
drop table t1;
|
||||
|
@ -258,7 +258,7 @@ void Field_str::add_binary_or_charset(String &res) const
|
||||
if (binary())
|
||||
len=cs->snprintf(cs,end,len," binary");
|
||||
else
|
||||
len=cs->snprintf(cs,end,len," character set %s",field_charset->name);
|
||||
len=cs->snprintf(cs,end,len," character set %s",field_charset->csname);
|
||||
res.length(oldlen+len);
|
||||
}
|
||||
}
|
||||
|
@ -676,9 +676,13 @@ int mysqld_show_create_db(THD *thd, const char *dbname,
|
||||
to=strxmov(to,"`",dbname,"`", NullS);
|
||||
|
||||
if (create.table_charset)
|
||||
to= strxmov(to," /*!40100 DEFAULT CHARACTER SET ",
|
||||
create.table_charset->name,"*/",NullS);
|
||||
|
||||
{
|
||||
int cl= (create.table_charset->state & MY_CS_PRIMARY) ? 0 : 1;
|
||||
to= strxmov(to," /*!40100"
|
||||
" DEFAULT CHARACTER SET ",create.table_charset->csname,
|
||||
cl ? " COLLATE " : "", cl ? create.table_charset->name : "",
|
||||
" */",NullS);
|
||||
}
|
||||
protocol->store(path, (uint) (to-path));
|
||||
|
||||
if (protocol->write())
|
||||
|
@ -558,7 +558,7 @@ int yylex(void *arg, void *yythd)
|
||||
*/
|
||||
|
||||
if ((yylval->lex_str.str[0]=='_') &&
|
||||
(lex->charset=get_charset_by_name(yylval->lex_str.str+1,MYF(0))))
|
||||
(lex->charset=get_charset_by_csname(yylval->lex_str.str+1,MYF(0))))
|
||||
return(UNDERSCORE_CHARSET);
|
||||
else
|
||||
return(IDENT);
|
||||
|
@ -676,6 +676,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
|
||||
List<Item> field_list;
|
||||
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("Collation",40));
|
||||
field_list.push_back(new Item_empty_string("Null",1));
|
||||
field_list.push_back(new Item_empty_string("Key",3));
|
||||
field_list.push_back(item=new Item_empty_string("Default",NAME_LEN));
|
||||
@ -721,6 +722,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
|
||||
protocol->store(field->field_name);
|
||||
field->sql_type(type);
|
||||
protocol->store(type.ptr(), type.length());
|
||||
protocol->store(field->charset()->name);
|
||||
|
||||
pos=(byte*) ((flags & NOT_NULL_FLAG) &&
|
||||
field->type() != FIELD_TYPE_TIMESTAMP ?
|
||||
@ -1050,6 +1052,16 @@ store_create_info(THD *thd, TABLE *table, String *packet)
|
||||
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->binary() && !(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);
|
||||
|
||||
@ -1162,8 +1174,13 @@ store_create_info(THD *thd, TABLE *table, String *packet)
|
||||
if (table->table_charset)
|
||||
{
|
||||
packet->append(" CHARSET=");
|
||||
packet->append(table->table_charset->csname);
|
||||
if (!(table->table_charset->state & MY_CS_PRIMARY))
|
||||
{
|
||||
packet->append(" COLLATE=");
|
||||
packet->append(table->table_charset->name);
|
||||
}
|
||||
}
|
||||
|
||||
if (table->min_rows)
|
||||
{
|
||||
|
@ -633,7 +633,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
|
||||
%type <charset>
|
||||
charset_name
|
||||
charset_name_or_default
|
||||
opt_default_charset
|
||||
collation_name
|
||||
collation_name_or_default
|
||||
|
||||
%type <variable> internal_variable_name
|
||||
|
||||
@ -857,13 +858,14 @@ create:
|
||||
lex->key_list.push_back(new Key($2,$4.str, $5, lex->col_list));
|
||||
lex->col_list.empty();
|
||||
}
|
||||
| CREATE DATABASE opt_if_not_exists ident opt_default_charset
|
||||
| CREATE DATABASE opt_if_not_exists ident
|
||||
{ Lex->create_info.table_charset=NULL; }
|
||||
opt_create_database_options
|
||||
{
|
||||
LEX *lex=Lex;
|
||||
lex->sql_command=SQLCOM_CREATE_DB;
|
||||
lex->name=$4.str;
|
||||
lex->create_info.options=$3;
|
||||
lex->create_info.table_charset=$5;
|
||||
}
|
||||
| CREATE udf_func_type UDF_SYM ident
|
||||
{
|
||||
@ -907,6 +909,22 @@ opt_as:
|
||||
/* empty */ {}
|
||||
| AS {};
|
||||
|
||||
opt_create_database_options:
|
||||
/* empty */ {}
|
||||
| create_database_options {};
|
||||
|
||||
create_database_options:
|
||||
create_database_option {}
|
||||
| create_database_options create_database_option {};
|
||||
|
||||
create_database_option:
|
||||
COLLATE_SYM collation_name_or_default
|
||||
{ Lex->create_info.table_charset=$2; }
|
||||
| opt_default CHAR_SYM SET charset_name_or_default
|
||||
{ Lex->create_info.table_charset=$4; }
|
||||
| opt_default CHARSET charset_name_or_default
|
||||
{ Lex->create_info.table_charset=$3; };
|
||||
|
||||
opt_table_options:
|
||||
/* empty */ { $$= 0; }
|
||||
| table_options { $$= $1;};
|
||||
@ -974,6 +992,11 @@ create_table_option:
|
||||
Lex->create_info.table_charset= $5;
|
||||
Lex->create_info.used_fields|= HA_CREATE_USED_CHARSET;
|
||||
}
|
||||
| COLLATE_SYM opt_equal collation_name_or_default
|
||||
{
|
||||
Lex->create_info.table_charset= $3;
|
||||
Lex->create_info.used_fields|= HA_CREATE_USED_CHARSET;
|
||||
}
|
||||
| INSERT_METHOD opt_equal merge_insert_types { Lex->create_info.merge_insert_method= $3; Lex->create_info.used_fields|= HA_CREATE_USED_INSERT_METHOD;}
|
||||
| DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING { Lex->create_info.data_file_name= $4.str; }
|
||||
| INDEX DIRECTORY_SYM opt_equal TEXT_STRING { Lex->create_info.index_file_name= $4.str; };
|
||||
@ -1232,13 +1255,13 @@ attribute:
|
||||
| UNIQUE_SYM { Lex->type|= UNIQUE_FLAG; }
|
||||
| UNIQUE_SYM KEY_SYM { Lex->type|= UNIQUE_KEY_FLAG; }
|
||||
| COMMENT_SYM text_literal { Lex->comment= $2; }
|
||||
| COLLATE_SYM charset_name { Lex->charset=$2; };
|
||||
| COLLATE_SYM collation_name { Lex->charset=$2; };
|
||||
|
||||
|
||||
charset_name:
|
||||
ident
|
||||
{
|
||||
if (!($$=get_charset_by_name($1.str,MYF(0))))
|
||||
if (!($$=get_charset_by_csname($1.str,MYF(0))))
|
||||
{
|
||||
net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,$1.str);
|
||||
YYABORT;
|
||||
@ -1249,15 +1272,24 @@ charset_name_or_default:
|
||||
charset_name { $$=$1; }
|
||||
| DEFAULT { $$=NULL; } ;
|
||||
|
||||
collation_name:
|
||||
ident
|
||||
{
|
||||
if (!($$=get_charset_by_name($1.str,MYF(0))))
|
||||
{
|
||||
net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,$1.str);
|
||||
YYABORT;
|
||||
}
|
||||
};
|
||||
|
||||
collation_name_or_default:
|
||||
collation_name { $$=$1; }
|
||||
| DEFAULT { $$=NULL; } ;
|
||||
|
||||
opt_default:
|
||||
/* empty */ {}
|
||||
| DEFAULT {};
|
||||
|
||||
opt_default_charset:
|
||||
/* empty */ { $$=default_charset_info; }
|
||||
| opt_default CHAR_SYM SET charset_name_or_default { $$=$4; }
|
||||
| opt_default CHARSET charset_name_or_default { $$=$3; };
|
||||
|
||||
opt_binary:
|
||||
/* empty */ { Lex->charset=NULL; }
|
||||
| ASCII_SYM { Lex->charset=my_charset_latin1; }
|
||||
@ -1400,12 +1432,11 @@ alter:
|
||||
}
|
||||
alter_list
|
||||
{}
|
||||
| ALTER DATABASE ident opt_default_charset
|
||||
| ALTER DATABASE ident opt_create_database_options
|
||||
{
|
||||
LEX *lex=Lex;
|
||||
lex->sql_command=SQLCOM_ALTER_DB;
|
||||
lex->name=$3.str;
|
||||
lex->create_info.table_charset=$4;
|
||||
};
|
||||
|
||||
|
||||
@ -1892,7 +1923,7 @@ expr_expr:
|
||||
{ $$= new Item_date_add_interval($1,$4,$5,0); }
|
||||
| expr '-' INTERVAL_SYM expr interval
|
||||
{ $$= new Item_date_add_interval($1,$4,$5,1); }
|
||||
| expr COLLATE_SYM charset_name
|
||||
| expr COLLATE_SYM collation_name
|
||||
{ $$= new Item_func_set_collation($1,$3); };
|
||||
|
||||
/* expressions that begin with 'expr' that do NOT follow IN_SYM */
|
||||
|
Reference in New Issue
Block a user