初版
This commit is contained in:
31
build/lib/mysql/mysql-test/r/1st.result
Normal file
31
build/lib/mysql/mysql-test/r/1st.result
Normal file
@@ -0,0 +1,31 @@
|
||||
show databases;
|
||||
Database
|
||||
information_schema
|
||||
mtr
|
||||
mysql
|
||||
test
|
||||
show tables in mysql;
|
||||
Tables_in_mysql
|
||||
columns_priv
|
||||
db
|
||||
event
|
||||
func
|
||||
general_log
|
||||
help_category
|
||||
help_keyword
|
||||
help_relation
|
||||
help_topic
|
||||
host
|
||||
ndb_binlog_index
|
||||
plugin
|
||||
proc
|
||||
procs_priv
|
||||
servers
|
||||
slow_log
|
||||
tables_priv
|
||||
time_zone
|
||||
time_zone_leap_second
|
||||
time_zone_name
|
||||
time_zone_transition
|
||||
time_zone_transition_type
|
||||
user
|
||||
75
build/lib/mysql/mysql-test/r/alias.result
Normal file
75
build/lib/mysql/mysql-test/r/alias.result
Normal file
@@ -0,0 +1,75 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (
|
||||
cont_nr int(11) NOT NULL auto_increment,
|
||||
ver_nr int(11) NOT NULL default '0',
|
||||
aufnr int(11) NOT NULL default '0',
|
||||
username varchar(50) NOT NULL default '',
|
||||
hdl_nr int(11) NOT NULL default '0',
|
||||
eintrag date NOT NULL default '0000-00-00',
|
||||
st_klasse varchar(40) NOT NULL default '',
|
||||
st_wert varchar(40) NOT NULL default '',
|
||||
st_zusatz varchar(40) NOT NULL default '',
|
||||
st_bemerkung varchar(255) NOT NULL default '',
|
||||
kunden_art varchar(40) NOT NULL default '',
|
||||
mcbs_knr int(11) default NULL,
|
||||
mcbs_aufnr int(11) NOT NULL default '0',
|
||||
schufa_status char(1) default '?',
|
||||
bemerkung text,
|
||||
wirknetz text,
|
||||
wf_igz int(11) NOT NULL default '0',
|
||||
tarifcode varchar(80) default NULL,
|
||||
recycle char(1) default NULL,
|
||||
sim varchar(30) default NULL,
|
||||
mcbs_tpl varchar(30) default NULL,
|
||||
emp_nr int(11) NOT NULL default '0',
|
||||
laufzeit int(11) default NULL,
|
||||
hdl_name varchar(30) default NULL,
|
||||
prov_hdl_nr int(11) NOT NULL default '0',
|
||||
auto_wirknetz varchar(50) default NULL,
|
||||
auto_billing varchar(50) default NULL,
|
||||
touch timestamp NOT NULL,
|
||||
kategorie varchar(50) default NULL,
|
||||
kundentyp varchar(20) NOT NULL default '',
|
||||
sammel_rech_msisdn varchar(30) NOT NULL default '',
|
||||
p_nr varchar(9) NOT NULL default '',
|
||||
suffix char(3) NOT NULL default '',
|
||||
PRIMARY KEY (cont_nr),
|
||||
KEY idx_aufnr(aufnr),
|
||||
KEY idx_hdl_nr(hdl_nr),
|
||||
KEY idx_st_klasse(st_klasse),
|
||||
KEY ver_nr(ver_nr),
|
||||
KEY eintrag_idx(eintrag),
|
||||
KEY emp_nr_idx(emp_nr),
|
||||
KEY wf_igz(wf_igz),
|
||||
KEY touch(touch),
|
||||
KEY hdl_tag(eintrag,hdl_nr),
|
||||
KEY prov_hdl_nr(prov_hdl_nr),
|
||||
KEY mcbs_aufnr(mcbs_aufnr),
|
||||
KEY kundentyp(kundentyp),
|
||||
KEY p_nr(p_nr,suffix)
|
||||
) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (3359356,405,3359356,'Mustermann Musterfrau',52500,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1485525,2122316,'+','','N',1909160,'MobilComSuper92000D2',NULL,NULL,'MS9ND2',3,24,'MobilCom Shop Koeln',52500,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
|
||||
INSERT INTO t1 VALUES (3359357,468,3359357,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1503580,2139699,'+','','P',1909171,'MobilComSuper9D1T10SFreisprech(Akquise)',NULL,NULL,'MS9NS1',327,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
|
||||
INSERT INTO t1 VALUES (3359358,407,3359358,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1501358,2137473,'N','','N',1909159,'MobilComSuper92000D2',NULL,NULL,'MS9ND2',325,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
|
||||
INSERT INTO t1 VALUES (3359359,468,3359359,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1507831,2143894,'+','','P',1909162,'MobilComSuper9D1T10SFreisprech(Akquise)',NULL,NULL,'MS9NS1',327,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
|
||||
INSERT INTO t1 VALUES (3359360,0,0,'Mustermann Musterfrau',29674907,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1900169997,2414578,'+',NULL,'N',1909148,'',NULL,NULL,'RV99066_2',20,NULL,'POS',29674907,NULL,NULL,20010202105916,'Mobilfunk','','','97317481','007');
|
||||
INSERT INTO t1 VALUES (3359361,406,3359361,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag storniert','','(7001-84):Storno, Kd. möchte nicht mehr','privat',NULL,0,'+','','P',1909150,'MobilComSuper92000D1(Akquise)',NULL,NULL,'MS9ND1',325,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
|
||||
INSERT INTO t1 VALUES (3359362,406,3359362,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprüft','','privat',1509984,2145874,'+','','P',1909154,'MobilComSuper92000D1(Akquise)',NULL,NULL,'MS9ND1',327,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
|
||||
SELECT ELT(FIELD(kundentyp,'PP','PPA','PG','PGA','FK','FKA','FP','FPA','K','KA','V','VA',''), 'Privat (Private Nutzung)','Privat (Private Nutzung) Sitz im Ausland','Privat (geschaeftliche Nutzung)','Privat (geschaeftliche Nutzung) Sitz im Ausland','Firma (Kapitalgesellschaft)','Firma (Kapitalgesellschaft) Sitz im Ausland','Firma (Personengesellschaft)','Firma (Personengesellschaft) Sitz im Ausland','oeff. rechtl. Koerperschaft','oeff. rechtl. Koerperschaft Sitz im Ausland','Eingetragener Verein','Eingetragener Verein Sitz im Ausland','Typ unbekannt') AS Kundentyp ,kategorie FROM t1 WHERE hdl_nr < 2000000 AND kategorie IN ('Prepaid','Mobilfunk') AND st_klasse = 'Workflow' GROUP BY kundentyp ORDER BY kategorie;
|
||||
Kundentyp kategorie
|
||||
Privat (Private Nutzung) Mobilfunk
|
||||
Warnings:
|
||||
Warning 1052 Column 'kundentyp' in group statement is ambiguous
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
AUFNR varchar(12) NOT NULL default '',
|
||||
PLNFL varchar(6) NOT NULL default '',
|
||||
VORNR varchar(4) NOT NULL default '',
|
||||
xstatus_vor smallint(5) unsigned NOT NULL default '0'
|
||||
);
|
||||
INSERT INTO t1 VALUES ('40004712','000001','0010',9);
|
||||
INSERT INTO t1 VALUES ('40004712','000001','0020',0);
|
||||
UPDATE t1 SET t1.xstatus_vor = Greatest(t1.xstatus_vor,1) WHERE t1.aufnr =
|
||||
"40004712" AND t1.plnfl = "000001" AND t1.vornr > "0010" ORDER BY t1.vornr
|
||||
ASC LIMIT 1;
|
||||
drop table t1;
|
||||
30
build/lib/mysql/mysql-test/r/almost_full.result
Normal file
30
build/lib/mysql/mysql-test/r/almost_full.result
Normal file
@@ -0,0 +1,30 @@
|
||||
call mtr.add_suppression("The table 't1' is full");
|
||||
drop table if exists t1;
|
||||
set global myisam_data_pointer_size=2;
|
||||
CREATE TABLE t1 (a int auto_increment primary key not null, b longtext) ENGINE=MyISAM;
|
||||
DELETE FROM t1 WHERE a=1 or a=5;
|
||||
INSERT INTO t1 SET b=repeat('a',600);
|
||||
ERROR HY000: The table 't1' is full
|
||||
CHECK TABLE t1 EXTENDED;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check warning Datafile is almost full, 65448 of 65534 used
|
||||
test.t1 check status OK
|
||||
UPDATE t1 SET b=repeat('a', 800) where a=10;
|
||||
ERROR HY000: The table 't1' is full
|
||||
CHECK TABLE t1 EXTENDED;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check warning Datafile is almost full, 65448 of 65534 used
|
||||
test.t1 check status OK
|
||||
INSERT INTO t1 SET b=repeat('a',400);
|
||||
CHECK TABLE t1 EXTENDED;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check warning Datafile is almost full, 65448 of 65534 used
|
||||
test.t1 check status OK
|
||||
DELETE FROM t1 WHERE a=2 or a=6;
|
||||
UPDATE t1 SET b=repeat('a', 600) where a=11;
|
||||
CHECK TABLE t1 EXTENDED;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check warning Datafile is almost full, 65448 of 65534 used
|
||||
test.t1 check status OK
|
||||
drop table t1;
|
||||
set global myisam_data_pointer_size=default;
|
||||
57
build/lib/mysql/mysql-test/r/alter_table-big.result
Normal file
57
build/lib/mysql/mysql-test/r/alter_table-big.result
Normal file
@@ -0,0 +1,57 @@
|
||||
drop table if exists t1, t2;
|
||||
create table t1 (n1 int, n2 int, n3 int,
|
||||
key (n1, n2, n3),
|
||||
key (n2, n3, n1),
|
||||
key (n3, n1, n2));
|
||||
create table t2 (i int);
|
||||
alter table t1 disable keys;
|
||||
insert into t1 values (RAND()*1000, RAND()*1000, RAND()*1000);
|
||||
reset master;
|
||||
set session debug="+d,sleep_alter_enable_indexes";
|
||||
alter table t1 enable keys;;
|
||||
insert into t2 values (1);
|
||||
insert into t1 values (1, 1, 1);
|
||||
set session debug="-d,sleep_alter_enable_indexes";
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; insert into t2 values (1)
|
||||
master-bin.000001 # Query # # use `test`; alter table t1 enable keys
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values (1, 1, 1)
|
||||
drop tables t1, t2;
|
||||
End of 5.0 tests
|
||||
drop table if exists t1, t2, t3;
|
||||
create table t1 (i int);
|
||||
reset master;
|
||||
set session debug="+d,sleep_alter_before_main_binlog";
|
||||
alter table t1 change i c char(10) default 'Test1';;
|
||||
insert into t1 values ();
|
||||
select * from t1;
|
||||
c
|
||||
Test1
|
||||
alter table t1 change c vc varchar(100) default 'Test2';;
|
||||
rename table t1 to t2;
|
||||
drop table t2;
|
||||
create table t1 (i int);
|
||||
alter table t1 change i c char(10) default 'Test3', rename to t2;;
|
||||
insert into t2 values ();
|
||||
select * from t2;
|
||||
c
|
||||
Test3
|
||||
alter table t2 change c vc varchar(100) default 'Test2', rename to t1;;
|
||||
rename table t1 to t3;
|
||||
drop table t3;
|
||||
set session debug="-d,sleep_alter_before_main_binlog";
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; alter table t1 change i c char(10) default 'Test1'
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values ()
|
||||
master-bin.000001 # Query # # use `test`; alter table t1 change c vc varchar(100) default 'Test2'
|
||||
master-bin.000001 # Query # # use `test`; rename table t1 to t2
|
||||
master-bin.000001 # Query # # use `test`; drop table t2
|
||||
master-bin.000001 # Query # # use `test`; create table t1 (i int)
|
||||
master-bin.000001 # Query # # use `test`; alter table t1 change i c char(10) default 'Test3', rename to t2
|
||||
master-bin.000001 # Query # # use `test`; insert into t2 values ()
|
||||
master-bin.000001 # Query # # use `test`; alter table t2 change c vc varchar(100) default 'Test2', rename to t1
|
||||
master-bin.000001 # Query # # use `test`; rename table t1 to t3
|
||||
master-bin.000001 # Query # # use `test`; drop table t3
|
||||
End of 5.1 tests
|
||||
1377
build/lib/mysql/mysql-test/r/alter_table.result
Normal file
1377
build/lib/mysql/mysql-test/r/alter_table.result
Normal file
File diff suppressed because it is too large
Load Diff
151
build/lib/mysql/mysql-test/r/analyse.result
Normal file
151
build/lib/mysql/mysql-test/r/analyse.result
Normal file
@@ -0,0 +1,151 @@
|
||||
drop table if exists t1,t2;
|
||||
create table t1 (i int, j int, empty_string char(10), bool char(1), d date);
|
||||
insert into t1 values (1,2,"","Y","2002-03-03"), (3,4,"","N","2002-03-04"), (5,6,"","Y","2002-03-04"), (7,8,"","N","2002-03-05");
|
||||
select count(*) from t1 procedure analyse();
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
count(*) 4 4 1 1 0 0 4.0000 0.0000 ENUM('4') NOT NULL
|
||||
select * from t1 procedure analyse();
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
test.t1.i 1 7 1 1 0 0 4.0000 2.2361 ENUM('1','3','5','7') NOT NULL
|
||||
test.t1.j 2 8 1 1 0 0 5.0000 2.2361 ENUM('2','4','6','8') NOT NULL
|
||||
test.t1.empty_string 0 0 4 0 0.0000 NULL CHAR(0) NOT NULL
|
||||
test.t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
|
||||
test.t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
|
||||
select * from t1 procedure analyse(2);
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
test.t1.i 1 7 1 1 0 0 4.0000 2.2361 TINYINT(1) UNSIGNED NOT NULL
|
||||
test.t1.j 2 8 1 1 0 0 5.0000 2.2361 TINYINT(1) UNSIGNED NOT NULL
|
||||
test.t1.empty_string 0 0 4 0 0.0000 NULL CHAR(0) NOT NULL
|
||||
test.t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
|
||||
test.t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
|
||||
create table t2 select * from t1 procedure analyse();
|
||||
ERROR HY000: Incorrect usage of PROCEDURE and non-SELECT
|
||||
drop table t1;
|
||||
EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
|
||||
ERROR HY000: Incorrect usage of PROCEDURE and subquery
|
||||
create table t1 (v varchar(128));
|
||||
insert into t1 values ('abc'),('abc\'def\\hij\"klm\0opq'),('\''),('\"'),('\\'),('a\0'),('b\''),('c\"'),('d\\'),('\'b'),('\"c'),('\\d'),('a\0\0\0b'),('a\'\'\'\'b'),('a\"\"\"\"b'),('a\\\\\\\\b'),('\'\0\\\"'),('\'\''),('\"\"'),('\\\\'),('The\ZEnd');
|
||||
select * from t1 procedure analyse();
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
test.t1.v " \\ 1 19 0 0 3.7619 NULL ENUM('"','""','"c','\'\0\\"','\'','\'\'','\'b','a\0\0\0b','a\0','a""""b','a\'\'\'\'b','abc','abc\'def\\hij"klm\0opq','a\\\\\\\\b','b\'','c"','d\\','The\ZEnd','\\','\\d','\\\\') NOT NULL
|
||||
drop table t1;
|
||||
create table t1 (df decimal(5,1));
|
||||
insert into t1 values(1.1);
|
||||
insert into t1 values(2.2);
|
||||
select * from t1 procedure analyse();
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
test.t1.df 1.1 2.2 13 13 0 0 1.65000 0.55000 ENUM('1.1','2.2') NOT NULL
|
||||
drop table t1;
|
||||
create table t1 (d double);
|
||||
insert into t1 values (100000);
|
||||
select * from t1 procedure analyse (1,1);
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
test.t1.d 100000 100000 6 6 0 0 100000 0 MEDIUMINT(6) UNSIGNED NOT NULL
|
||||
drop table t1;
|
||||
create table t1 (product varchar(32), country_id int not null, year int,
|
||||
profit int);
|
||||
insert into t1 values ( 'Computer', 2,2000, 1200),
|
||||
( 'TV', 1, 1999, 150),
|
||||
( 'Calculator', 1, 1999,50),
|
||||
( 'Computer', 1, 1999,1500),
|
||||
( 'Computer', 1, 2000,1500),
|
||||
( 'TV', 1, 2000, 150),
|
||||
( 'TV', 2, 2000, 100),
|
||||
( 'TV', 2, 2000, 100),
|
||||
( 'Calculator', 1, 2000,75),
|
||||
( 'Calculator', 2, 2000,75),
|
||||
( 'TV', 1, 1999, 100),
|
||||
( 'Computer', 1, 1999,1200),
|
||||
( 'Computer', 2, 2000,1500),
|
||||
( 'Calculator', 2, 2000,75),
|
||||
( 'Phone', 3, 2003,10)
|
||||
;
|
||||
create table t2 (country_id int primary key, country char(20) not null);
|
||||
insert into t2 values (1, 'USA'),(2,'India'), (3,'Finland');
|
||||
select product, sum(profit),avg(profit) from t1 group by product with rollup procedure analyse();
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
test.t1.product Computer TV 2 8 0 0 4.2500 NULL ENUM('Computer','Phone','TV') NOT NULL
|
||||
sum(profit) 10 6900 11 11 0 0 1946.2500 2867.6719 ENUM('10','275','600','6900') NOT NULL
|
||||
avg(profit) 10.0000 1380.0000 16 16 0 0 394.68750000 570.20033144 ENUM('10.0000','68.7500','120.0000','1380.0000') NOT NULL
|
||||
drop table t1,t2;
|
||||
create table t1 (f1 double(10,5), f2 char(10), f3 double(10,5));
|
||||
insert into t1 values (5.999, "5.9999", 5.99999), (9.555, "9.5555", 9.55555);
|
||||
select f1 from t1 procedure analyse(1, 1);
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
test.t1.f1 5.99900 9.55500 7 7 0 0 7.77700 1.77800 FLOAT(4,3) NOT NULL
|
||||
select f2 from t1 procedure analyse(1, 1);
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
test.t1.f2 5.9999 9.5555 6 6 0 0 6.0000 NULL FLOAT(5,4) UNSIGNED NOT NULL
|
||||
select f3 from t1 procedure analyse(1, 1);
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
test.t1.f3 5.99999 9.55555 7 7 0 0 7.77777 1.77778 FLOAT(6,5) NOT NULL
|
||||
drop table t1;
|
||||
CREATE TABLE t1(a INT,b INT,c INT,d INT,e INT,f INT,g INT,h INT,i INT,j INT,k INT);
|
||||
INSERT INTO t1 VALUES ();
|
||||
SELECT * FROM (SELECT * FROM t1) d PROCEDURE ANALYSE();
|
||||
ERROR HY000: Incorrect usage of PROCEDURE and subquery
|
||||
DROP TABLE t1;
|
||||
End of 4.1 tests
|
||||
#
|
||||
# Bug #48293: crash with procedure analyse, view with > 10 columns,
|
||||
# having clause...
|
||||
#
|
||||
CREATE TABLE t1(a INT, b INT, c INT, d INT, e INT,
|
||||
f INT, g INT, h INT, i INT, j INT,k INT);
|
||||
INSERT INTO t1 VALUES (),();
|
||||
CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
|
||||
#should have a derived table
|
||||
EXPLAIN SELECT * FROM v1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 2
|
||||
#should not crash
|
||||
SELECT * FROM v1 PROCEDURE analyse();
|
||||
ERROR HY000: Incorrect usage of PROCEDURE and view
|
||||
#should not crash
|
||||
SELECT * FROM t1 a, v1, t1 b PROCEDURE analyse();
|
||||
ERROR HY000: Incorrect usage of PROCEDURE and view
|
||||
#should not crash
|
||||
SELECT * FROM (SELECT * FROM t1 having a > 1) x PROCEDURE analyse();
|
||||
ERROR HY000: Incorrect usage of PROCEDURE and subquery
|
||||
#should not crash
|
||||
SELECT * FROM t1 a, (SELECT * FROM t1 having a > 1) x, t1 b PROCEDURE analyse();
|
||||
ERROR HY000: Incorrect usage of PROCEDURE and subquery
|
||||
#should not crash
|
||||
SELECT 1 FROM t1 group by a having a > 1 order by 1 PROCEDURE analyse();
|
||||
ERROR HY000: Can't use ORDER clause with this procedure
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(a INT);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
# should not crash
|
||||
CREATE TABLE t2 SELECT 1 FROM t1, t1 t3 GROUP BY t3.a PROCEDURE ANALYSE();
|
||||
ERROR HY000: Incorrect usage of PROCEDURE and non-SELECT
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
#
|
||||
# Bug#11765202: Dbug_violation_helper::~Dbug_violation_helper(): Assertion `!_entered' failed.
|
||||
#
|
||||
DROP TABLE IF EXISTS t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
CREATE TABLE t1 (a VARCHAR(2) CHARSET UTF8 NOT NULL);
|
||||
INSERT INTO t1 VALUES ('e'),('e'),('e-');
|
||||
SELECT * FROM t1 PROCEDURE ANALYSE();
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
test.t1.a e e- 1 2 0 0 1.3333 NULL ENUM('e','e-') NOT NULL
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#11756242 48137: PROCEDURE ANALYSE() LEAKS MEMORY WHEN RETURNING NULL
|
||||
#
|
||||
CREATE TABLE t1(f1 INT) ENGINE=MYISAM;
|
||||
CREATE TABLE t2(f2 INT) ENGINE=INNODB;
|
||||
INSERT INTO t2 VALUES (1);
|
||||
SELECT DISTINCTROW f1 FROM t1 NATURAL RIGHT OUTER JOIN t2 PROCEDURE ANALYSE();
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
test.t1.f1 NULL NULL 0 0 0 1 0.0 0.0 CHAR(0)
|
||||
SELECT * FROM t2 LIMIT 1 PROCEDURE ANALYSE();
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
test.t2.f2 1 1 1 1 0 0 1.0000 0.0000 ENUM('1') NOT NULL
|
||||
DROP TABLE t1, t2;
|
||||
End of 5.1 tests
|
||||
66
build/lib/mysql/mysql-test/r/analyze.result
Normal file
66
build/lib/mysql/mysql-test/r/analyze.result
Normal file
@@ -0,0 +1,66 @@
|
||||
create table t1 (a bigint);
|
||||
lock tables t1 write;
|
||||
insert into t1 values(0);
|
||||
analyze table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status OK
|
||||
unlock tables;
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
drop table t1;
|
||||
create table t1 (a bigint);
|
||||
insert into t1 values(0);
|
||||
lock tables t1 write;
|
||||
delete from t1;
|
||||
analyze table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status OK
|
||||
unlock tables;
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
drop table t1;
|
||||
create table t1 (a bigint);
|
||||
insert into t1 values(0);
|
||||
analyze table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status OK
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
drop table t1;
|
||||
create table t1 (a mediumtext, fulltext key key1(a)) charset utf8 collate utf8_general_ci engine myisam;
|
||||
insert into t1 values ('hello');
|
||||
analyze table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status OK
|
||||
analyze table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status Table is already up to date
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (a int);
|
||||
prepare stmt1 from "SELECT * FROM t1 PROCEDURE ANALYSE()";
|
||||
execute stmt1;
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
execute stmt1;
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
deallocate prepare stmt1;
|
||||
drop table t1;
|
||||
create temporary table t1(a int, index(a));
|
||||
insert into t1 values('1'),('2'),('3'),('4'),('5');
|
||||
analyze table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status OK
|
||||
show index from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 1 a 1 a A 5 NULL NULL YES BTREE
|
||||
drop table t1;
|
||||
End of 4.1 tests
|
||||
create table t1(a int);
|
||||
analyze table t1 extended;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'extended' at line 1
|
||||
optimize table t1 extended;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'extended' at line 1
|
||||
drop table t1;
|
||||
End of 5.0 tests
|
||||
48
build/lib/mysql/mysql-test/r/ansi.result
Normal file
48
build/lib/mysql/mysql-test/r/ansi.result
Normal file
@@ -0,0 +1,48 @@
|
||||
drop table if exists t1;
|
||||
set sql_mode="MySQL40";
|
||||
select @@sql_mode;
|
||||
@@sql_mode
|
||||
MYSQL40,HIGH_NOT_PRECEDENCE
|
||||
set @@sql_mode="ANSI";
|
||||
select @@sql_mode;
|
||||
@@sql_mode
|
||||
REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI
|
||||
SELECT 'A' || 'B';
|
||||
'A' || 'B'
|
||||
AB
|
||||
CREATE TABLE t1 (id INT, id2 int);
|
||||
SELECT id,NULL,1,1.1,'a' FROM t1 GROUP BY id;
|
||||
id NULL 1 1.1 a
|
||||
SELECT id FROM t1 GROUP BY id2;
|
||||
id
|
||||
drop table t1;
|
||||
SET @@SQL_MODE="";
|
||||
CREATE TABLE t1 (i int auto_increment NOT NULL, PRIMARY KEY (i));
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`i` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`i`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SET @@SQL_MODE="MYSQL323";
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`i` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`i`)
|
||||
) TYPE=MyISAM
|
||||
SET @@SQL_MODE="MYSQL40";
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`i` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`i`)
|
||||
) TYPE=MyISAM
|
||||
SET @@SQL_MODE="NO_FIELD_OPTIONS";
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`i` int(11) NOT NULL,
|
||||
PRIMARY KEY (`i`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
19
build/lib/mysql/mysql-test/r/archive-big.result
Normal file
19
build/lib/mysql/mysql-test/r/archive-big.result
Normal file
@@ -0,0 +1,19 @@
|
||||
CREATE TABLE t1(a BLOB) ENGINE=ARCHIVE;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
12793
build/lib/mysql/mysql-test/r/archive.result
Normal file
12793
build/lib/mysql/mysql-test/r/archive.result
Normal file
File diff suppressed because it is too large
Load Diff
191
build/lib/mysql/mysql-test/r/archive_bitfield.result
Normal file
191
build/lib/mysql/mysql-test/r/archive_bitfield.result
Normal file
@@ -0,0 +1,191 @@
|
||||
drop table if exists t1;
|
||||
create table t1 (
|
||||
pk1 int not null auto_increment primary key,
|
||||
b bit(64)
|
||||
) engine=archive;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`pk1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`b` bit(64) DEFAULT NULL,
|
||||
PRIMARY KEY (`pk1`)
|
||||
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
|
||||
insert into t1 values
|
||||
(NULL,b'1111111111111111111111111111111111111111111111111111111111111111'),
|
||||
(NULL,b'1000000000000000000000000000000000000000000000000000000000000000'),
|
||||
(NULL,b'0000000000000000000000000000000000000000000000000000000000000001'),
|
||||
(NULL,b'1010101010101010101010101010101010101010101010101010101010101010'),
|
||||
(NULL,b'0101010101010101010101010101010101010101010101010101010101010101');
|
||||
select hex(b) from t1 order by pk1;
|
||||
hex(b)
|
||||
FFFFFFFFFFFFFFFF
|
||||
8000000000000000
|
||||
1
|
||||
AAAAAAAAAAAAAAAA
|
||||
5555555555555555
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
pk1 int not null auto_increment primary key,
|
||||
b bit(9)
|
||||
) engine=archive;
|
||||
insert into t1 values
|
||||
(NULL,b'000000000'),
|
||||
(NULL,b'000000001'),
|
||||
(NULL,b'000000010'),
|
||||
(NULL,b'000000011'),
|
||||
(NULL,b'000000100');
|
||||
select hex(b) from t1 order by pk1;
|
||||
hex(b)
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
drop table t1;
|
||||
create table t1 (a bit(7), b bit(9)) engine = archive;
|
||||
insert into t1 values
|
||||
(94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),
|
||||
(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),
|
||||
(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),
|
||||
(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),
|
||||
(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),
|
||||
(44, 307), (68, 454), (57, 135);
|
||||
select a+0 from t1 order by a;
|
||||
a+0
|
||||
0
|
||||
4
|
||||
5
|
||||
9
|
||||
23
|
||||
24
|
||||
28
|
||||
29
|
||||
30
|
||||
31
|
||||
34
|
||||
44
|
||||
49
|
||||
56
|
||||
57
|
||||
59
|
||||
60
|
||||
61
|
||||
68
|
||||
68
|
||||
75
|
||||
77
|
||||
78
|
||||
79
|
||||
87
|
||||
88
|
||||
94
|
||||
94
|
||||
104
|
||||
106
|
||||
108
|
||||
111
|
||||
116
|
||||
118
|
||||
119
|
||||
122
|
||||
123
|
||||
127
|
||||
select b+0 from t1 order by b;
|
||||
b+0
|
||||
36
|
||||
42
|
||||
46
|
||||
67
|
||||
83
|
||||
118
|
||||
123
|
||||
133
|
||||
135
|
||||
152
|
||||
177
|
||||
178
|
||||
188
|
||||
202
|
||||
206
|
||||
245
|
||||
280
|
||||
307
|
||||
343
|
||||
345
|
||||
349
|
||||
351
|
||||
363
|
||||
368
|
||||
368
|
||||
379
|
||||
380
|
||||
390
|
||||
398
|
||||
399
|
||||
403
|
||||
411
|
||||
411
|
||||
438
|
||||
446
|
||||
454
|
||||
468
|
||||
499
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
dummyKey INTEGER NOT NULL AUTO_INCREMENT,
|
||||
a001 TINYINT,
|
||||
a010 TINYINT,
|
||||
a012 TINYINT,
|
||||
a015 TINYINT,
|
||||
a016 TINYINT,
|
||||
a017 TINYINT,
|
||||
a019 TINYINT,
|
||||
a029 TINYINT,
|
||||
a030 TINYINT,
|
||||
a031 TINYINT,
|
||||
a032 TINYINT,
|
||||
a042 TINYINT,
|
||||
a043 TINYINT,
|
||||
a044 TINYINT,
|
||||
a3001 TINYINT,
|
||||
a3002 TINYINT,
|
||||
a3003 TINYINT,
|
||||
a3004 TINYINT,
|
||||
a3005 TINYINT,
|
||||
a3021 TINYINT,
|
||||
a3022 TINYINT,
|
||||
a BIT(6),
|
||||
b BIT(6),
|
||||
c BIT(6),
|
||||
d TINYINT,
|
||||
e TINYINT,
|
||||
f TINYINT,
|
||||
g TINYINT,
|
||||
h TINYINT,
|
||||
i TINYINT,
|
||||
j TINYINT,
|
||||
k TINYINT,
|
||||
l TINYINT,
|
||||
m TINYINT,
|
||||
n TINYINT,
|
||||
o TINYINT,
|
||||
a034 TINYINT,
|
||||
PRIMARY KEY USING HASH (dummyKey) ) engine=archive;
|
||||
INSERT INTO `t1` VALUES
|
||||
(NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000001',b'111111',b'111110',4,5,5,5,5,5,5,5,5,5,3,2,1),
|
||||
(NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000010',b'000000',b'111101',4,5,5,5,5,5,5,5,5,5,3,2,1),
|
||||
(NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000100',b'001111',b'111011',4,5,5,5,5,5,5,5,5,5,3,2,1),
|
||||
(NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'001000',b'110000',b'110111',4,5,5,5,5,5,5,5,5,5,3,2,1),
|
||||
(NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'010000',b'100001',b'101111',4,5,5,5,5,5,5,5,5,5,3,2,1),
|
||||
(NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'100000',b'010010',b'011111',4,5,5,5,5,5,5,5,5,5,3,2,1),
|
||||
(NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'001100',b'111111',4,5,5,5,5,5,5,5,5,5,3,2,1),
|
||||
(NULL,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO `t1` VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x01,0x3F,0x3E,4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO `t1` VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x02,0x00,0x3D,4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO `t1` VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x04,0x0F,0x3B,4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO `t1` VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x08,0x30,0x37,4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO `t1` VALUES (5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x10,0x21,0x2F,4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO `t1` VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x20,0x12,0x1F,4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO `t1` VALUES (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x00,0x0C,0x3F,4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
INSERT INTO `t1` VALUES (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x3F,0x00,0x00,4,5,5,5,5,5,5,5,5,5,3,2,1);
|
||||
drop table t1;
|
||||
12
build/lib/mysql/mysql-test/r/archive_debug.result
Normal file
12
build/lib/mysql/mysql-test/r/archive_debug.result
Normal file
@@ -0,0 +1,12 @@
|
||||
#
|
||||
# BUG#12402794 - 60976: CRASH, VALGRIND WARNING AND MEMORY LEAK
|
||||
# WITH PARTITIONED ARCHIVE TABLES
|
||||
#
|
||||
CREATE TABLE t1(a INT) ENGINE=ARCHIVE;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
SET SESSION debug='d,simulate_archive_open_failure';
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check error Corrupt
|
||||
SET SESSION debug=DEFAULT;
|
||||
DROP TABLE t1;
|
||||
548
build/lib/mysql/mysql-test/r/archive_gis.result
Normal file
548
build/lib/mysql/mysql-test/r/archive_gis.result
Normal file
@@ -0,0 +1,548 @@
|
||||
SET storage_engine=archive;
|
||||
DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
|
||||
CREATE TABLE gis_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POINT);
|
||||
CREATE TABLE gis_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g LINESTRING);
|
||||
CREATE TABLE gis_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POLYGON);
|
||||
CREATE TABLE gis_multi_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOINT);
|
||||
CREATE TABLE gis_multi_line (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTILINESTRING);
|
||||
CREATE TABLE gis_multi_polygon (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g MULTIPOLYGON);
|
||||
CREATE TABLE gis_geometrycollection (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRYCOLLECTION);
|
||||
CREATE TABLE gis_geometry (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g GEOMETRY);
|
||||
SHOW CREATE TABLE gis_point;
|
||||
Table Create Table
|
||||
gis_point CREATE TABLE `gis_point` (
|
||||
`fid` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`g` point DEFAULT NULL,
|
||||
PRIMARY KEY (`fid`)
|
||||
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
|
||||
SHOW FIELDS FROM gis_point;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL auto_increment
|
||||
g point YES NULL
|
||||
SHOW FIELDS FROM gis_line;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL auto_increment
|
||||
g linestring YES NULL
|
||||
SHOW FIELDS FROM gis_polygon;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL auto_increment
|
||||
g polygon YES NULL
|
||||
SHOW FIELDS FROM gis_multi_point;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL auto_increment
|
||||
g multipoint YES NULL
|
||||
SHOW FIELDS FROM gis_multi_line;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL auto_increment
|
||||
g multilinestring YES NULL
|
||||
SHOW FIELDS FROM gis_multi_polygon;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL auto_increment
|
||||
g multipolygon YES NULL
|
||||
SHOW FIELDS FROM gis_geometrycollection;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL auto_increment
|
||||
g geometrycollection YES NULL
|
||||
SHOW FIELDS FROM gis_geometry;
|
||||
Field Type Null Key Default Extra
|
||||
fid int(11) NO PRI NULL auto_increment
|
||||
g geometry YES NULL
|
||||
INSERT INTO gis_point VALUES
|
||||
(101, PointFromText('POINT(10 10)')),
|
||||
(102, PointFromText('POINT(20 10)')),
|
||||
(103, PointFromText('POINT(20 20)')),
|
||||
(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
|
||||
INSERT INTO gis_line VALUES
|
||||
(105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
|
||||
(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
|
||||
(107, LineStringFromWKB(LineString(Point(10, 10), Point(40, 10))));
|
||||
INSERT INTO gis_polygon VALUES
|
||||
(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
|
||||
(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
|
||||
(110, PolyFromWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)))));
|
||||
INSERT INTO gis_multi_point VALUES
|
||||
(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
|
||||
(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
|
||||
(113, MPointFromWKB(MultiPoint(Point(3, 6), Point(4, 10))));
|
||||
INSERT INTO gis_multi_line VALUES
|
||||
(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
|
||||
(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
|
||||
(116, MLineFromWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7)))));
|
||||
INSERT INTO gis_multi_polygon VALUES
|
||||
(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
|
||||
(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
|
||||
(119, MPolyFromWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))))));
|
||||
INSERT INTO gis_geometrycollection VALUES
|
||||
(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
|
||||
(121, GeometryFromWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))));
|
||||
INSERT into gis_geometry SELECT * FROM gis_point;
|
||||
INSERT into gis_geometry SELECT * FROM gis_line;
|
||||
INSERT into gis_geometry SELECT * FROM gis_polygon;
|
||||
INSERT into gis_geometry SELECT * FROM gis_multi_point;
|
||||
INSERT into gis_geometry SELECT * FROM gis_multi_line;
|
||||
INSERT into gis_geometry SELECT * FROM gis_multi_polygon;
|
||||
INSERT into gis_geometry SELECT * FROM gis_geometrycollection;
|
||||
SELECT fid, AsText(g) FROM gis_point ORDER by fid;
|
||||
fid AsText(g)
|
||||
101 POINT(10 10)
|
||||
102 POINT(20 10)
|
||||
103 POINT(20 20)
|
||||
104 POINT(10 20)
|
||||
SELECT fid, AsText(g) FROM gis_line ORDER by fid;
|
||||
fid AsText(g)
|
||||
105 LINESTRING(0 0,0 10,10 0)
|
||||
106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
|
||||
107 LINESTRING(10 10,40 10)
|
||||
SELECT fid, AsText(g) FROM gis_polygon ORDER by fid;
|
||||
fid AsText(g)
|
||||
108 POLYGON((10 10,20 10,20 20,10 20,10 10))
|
||||
109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
|
||||
110 POLYGON((0 0,30 0,30 30,0 0))
|
||||
SELECT fid, AsText(g) FROM gis_multi_point ORDER by fid;
|
||||
fid AsText(g)
|
||||
111 MULTIPOINT(0 0,10 10,10 20,20 20)
|
||||
112 MULTIPOINT(1 1,11 11,11 21,21 21)
|
||||
113 MULTIPOINT(3 6,4 10)
|
||||
SELECT fid, AsText(g) FROM gis_multi_line ORDER by fid;
|
||||
fid AsText(g)
|
||||
114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
|
||||
115 MULTILINESTRING((10 48,10 21,10 0))
|
||||
116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
|
||||
SELECT fid, AsText(g) FROM gis_multi_polygon ORDER by fid;
|
||||
fid AsText(g)
|
||||
117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
|
||||
118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
|
||||
119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
|
||||
SELECT fid, AsText(g) FROM gis_geometrycollection ORDER by fid;
|
||||
fid AsText(g)
|
||||
120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
|
||||
121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
|
||||
SELECT fid, AsText(g) FROM gis_geometry ORDER by fid;
|
||||
fid AsText(g)
|
||||
101 POINT(10 10)
|
||||
102 POINT(20 10)
|
||||
103 POINT(20 20)
|
||||
104 POINT(10 20)
|
||||
105 LINESTRING(0 0,0 10,10 0)
|
||||
106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
|
||||
107 LINESTRING(10 10,40 10)
|
||||
108 POLYGON((10 10,20 10,20 20,10 20,10 10))
|
||||
109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
|
||||
110 POLYGON((0 0,30 0,30 30,0 0))
|
||||
111 MULTIPOINT(0 0,10 10,10 20,20 20)
|
||||
112 MULTIPOINT(1 1,11 11,11 21,21 21)
|
||||
113 MULTIPOINT(3 6,4 10)
|
||||
114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
|
||||
115 MULTILINESTRING((10 48,10 21,10 0))
|
||||
116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
|
||||
117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
|
||||
118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
|
||||
119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
|
||||
120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
|
||||
121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
|
||||
SELECT fid, Dimension(g) FROM gis_geometry ORDER by fid;
|
||||
fid Dimension(g)
|
||||
101 0
|
||||
102 0
|
||||
103 0
|
||||
104 0
|
||||
105 1
|
||||
106 1
|
||||
107 1
|
||||
108 2
|
||||
109 2
|
||||
110 2
|
||||
111 0
|
||||
112 0
|
||||
113 0
|
||||
114 1
|
||||
115 1
|
||||
116 1
|
||||
117 2
|
||||
118 2
|
||||
119 2
|
||||
120 1
|
||||
121 1
|
||||
SELECT fid, GeometryType(g) FROM gis_geometry ORDER by fid;
|
||||
fid GeometryType(g)
|
||||
101 POINT
|
||||
102 POINT
|
||||
103 POINT
|
||||
104 POINT
|
||||
105 LINESTRING
|
||||
106 LINESTRING
|
||||
107 LINESTRING
|
||||
108 POLYGON
|
||||
109 POLYGON
|
||||
110 POLYGON
|
||||
111 MULTIPOINT
|
||||
112 MULTIPOINT
|
||||
113 MULTIPOINT
|
||||
114 MULTILINESTRING
|
||||
115 MULTILINESTRING
|
||||
116 MULTILINESTRING
|
||||
117 MULTIPOLYGON
|
||||
118 MULTIPOLYGON
|
||||
119 MULTIPOLYGON
|
||||
120 GEOMETRYCOLLECTION
|
||||
121 GEOMETRYCOLLECTION
|
||||
SELECT fid, IsEmpty(g) FROM gis_geometry ORDER by fid;
|
||||
fid IsEmpty(g)
|
||||
101 0
|
||||
102 0
|
||||
103 0
|
||||
104 0
|
||||
105 0
|
||||
106 0
|
||||
107 0
|
||||
108 0
|
||||
109 0
|
||||
110 0
|
||||
111 0
|
||||
112 0
|
||||
113 0
|
||||
114 0
|
||||
115 0
|
||||
116 0
|
||||
117 0
|
||||
118 0
|
||||
119 0
|
||||
120 0
|
||||
121 0
|
||||
SELECT fid, AsText(Envelope(g)) FROM gis_geometry ORDER by fid;
|
||||
fid AsText(Envelope(g))
|
||||
101 POLYGON((10 10,10 10,10 10,10 10,10 10))
|
||||
102 POLYGON((20 10,20 10,20 10,20 10,20 10))
|
||||
103 POLYGON((20 20,20 20,20 20,20 20,20 20))
|
||||
104 POLYGON((10 20,10 20,10 20,10 20,10 20))
|
||||
105 POLYGON((0 0,10 0,10 10,0 10,0 0))
|
||||
106 POLYGON((10 10,20 10,20 20,10 20,10 10))
|
||||
107 POLYGON((10 10,40 10,40 10,10 10,10 10))
|
||||
108 POLYGON((10 10,20 10,20 20,10 20,10 10))
|
||||
109 POLYGON((0 0,50 0,50 50,0 50,0 0))
|
||||
110 POLYGON((0 0,30 0,30 30,0 30,0 0))
|
||||
111 POLYGON((0 0,20 0,20 20,0 20,0 0))
|
||||
112 POLYGON((1 1,21 1,21 21,1 21,1 1))
|
||||
113 POLYGON((3 6,4 6,4 10,3 10,3 6))
|
||||
114 POLYGON((10 0,16 0,16 48,10 48,10 0))
|
||||
115 POLYGON((10 0,10 0,10 48,10 48,10 0))
|
||||
116 POLYGON((1 2,21 2,21 8,1 8,1 2))
|
||||
117 POLYGON((28 0,84 0,84 42,28 42,28 0))
|
||||
118 POLYGON((28 0,84 0,84 42,28 42,28 0))
|
||||
119 POLYGON((0 0,3 0,3 3,0 3,0 0))
|
||||
120 POLYGON((0 0,10 0,10 10,0 10,0 0))
|
||||
121 POLYGON((3 6,44 6,44 9,3 9,3 6))
|
||||
explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 21 100.00
|
||||
Warnings:
|
||||
Note 1003 select dimension(`test`.`gis_geometry`.`g`) AS `Dimension(g)`,geometrytype(`test`.`gis_geometry`.`g`) AS `GeometryType(g)`,isempty(`test`.`gis_geometry`.`g`) AS `IsEmpty(g)`,astext(envelope(`test`.`gis_geometry`.`g`)) AS `AsText(Envelope(g))` from `test`.`gis_geometry`
|
||||
SELECT fid, X(g) FROM gis_point ORDER by fid;
|
||||
fid X(g)
|
||||
101 10
|
||||
102 20
|
||||
103 20
|
||||
104 10
|
||||
SELECT fid, Y(g) FROM gis_point ORDER by fid;
|
||||
fid Y(g)
|
||||
101 10
|
||||
102 10
|
||||
103 20
|
||||
104 20
|
||||
explain extended select X(g),Y(g) FROM gis_point;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 100.00
|
||||
Warnings:
|
||||
Note 1003 select x(`test`.`gis_point`.`g`) AS `X(g)`,y(`test`.`gis_point`.`g`) AS `Y(g)` from `test`.`gis_point`
|
||||
SELECT fid, AsText(StartPoint(g)) FROM gis_line ORDER by fid;
|
||||
fid AsText(StartPoint(g))
|
||||
105 POINT(0 0)
|
||||
106 POINT(10 10)
|
||||
107 POINT(10 10)
|
||||
SELECT fid, AsText(EndPoint(g)) FROM gis_line ORDER by fid;
|
||||
fid AsText(EndPoint(g))
|
||||
105 POINT(10 0)
|
||||
106 POINT(10 10)
|
||||
107 POINT(40 10)
|
||||
SELECT fid, GLength(g) FROM gis_line ORDER by fid;
|
||||
fid GLength(g)
|
||||
105 24.142135623731
|
||||
106 40
|
||||
107 30
|
||||
SELECT fid, NumPoints(g) FROM gis_line ORDER by fid;
|
||||
fid NumPoints(g)
|
||||
105 3
|
||||
106 5
|
||||
107 2
|
||||
SELECT fid, AsText(PointN(g, 2)) FROM gis_line ORDER by fid;
|
||||
fid AsText(PointN(g, 2))
|
||||
105 POINT(0 10)
|
||||
106 POINT(20 10)
|
||||
107 POINT(40 10)
|
||||
SELECT fid, IsClosed(g) FROM gis_line ORDER by fid;
|
||||
fid IsClosed(g)
|
||||
105 0
|
||||
106 1
|
||||
107 0
|
||||
explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM gis_line;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 100.00
|
||||
Warnings:
|
||||
Note 1003 select astext(startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint(g))`,astext(endpoint(`test`.`gis_line`.`g`)) AS `AsText(EndPoint(g))`,glength(`test`.`gis_line`.`g`) AS `GLength(g)`,numpoints(`test`.`gis_line`.`g`) AS `NumPoints(g)`,astext(pointn(`test`.`gis_line`.`g`,2)) AS `AsText(PointN(g, 2))`,isclosed(`test`.`gis_line`.`g`) AS `IsClosed(g)` from `test`.`gis_line`
|
||||
SELECT fid, AsText(Centroid(g)) FROM gis_polygon ORDER by fid;
|
||||
fid AsText(Centroid(g))
|
||||
108 POINT(15 15)
|
||||
109 POINT(25.4166666666667 25.4166666666667)
|
||||
110 POINT(20 10)
|
||||
SELECT fid, Area(g) FROM gis_polygon ORDER by fid;
|
||||
fid Area(g)
|
||||
108 100
|
||||
109 2400
|
||||
110 450
|
||||
SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon ORDER by fid;
|
||||
fid AsText(ExteriorRing(g))
|
||||
108 LINESTRING(10 10,20 10,20 20,10 20,10 10)
|
||||
109 LINESTRING(0 0,50 0,50 50,0 50,0 0)
|
||||
110 LINESTRING(0 0,30 0,30 30,0 0)
|
||||
SELECT fid, NumInteriorRings(g) FROM gis_polygon ORDER by fid;
|
||||
fid NumInteriorRings(g)
|
||||
108 0
|
||||
109 1
|
||||
110 0
|
||||
SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon ORDER by fid;
|
||||
fid AsText(InteriorRingN(g, 1))
|
||||
108 NULL
|
||||
109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
|
||||
110 NULL
|
||||
explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumInteriorRings(g),AsText(InteriorRingN(g, 1)) FROM gis_polygon;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 100.00
|
||||
Warnings:
|
||||
Note 1003 select astext(centroid(`test`.`gis_polygon`.`g`)) AS `AsText(Centroid(g))`,area(`test`.`gis_polygon`.`g`) AS `Area(g)`,astext(exteriorring(`test`.`gis_polygon`.`g`)) AS `AsText(ExteriorRing(g))`,numinteriorrings(`test`.`gis_polygon`.`g`) AS `NumInteriorRings(g)`,astext(interiorringn(`test`.`gis_polygon`.`g`,1)) AS `AsText(InteriorRingN(g, 1))` from `test`.`gis_polygon`
|
||||
SELECT fid, IsClosed(g) FROM gis_multi_line ORDER by fid;
|
||||
fid IsClosed(g)
|
||||
114 0
|
||||
115 0
|
||||
116 0
|
||||
SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon ORDER by fid;
|
||||
fid AsText(Centroid(g))
|
||||
117 POINT(55.5885277530424 17.426536064114)
|
||||
118 POINT(55.5885277530424 17.426536064114)
|
||||
119 POINT(2 2)
|
||||
SELECT fid, Area(g) FROM gis_multi_polygon ORDER by fid;
|
||||
fid Area(g)
|
||||
117 1684.5
|
||||
118 1684.5
|
||||
119 4.5
|
||||
SELECT fid, NumGeometries(g) from gis_multi_point ORDER by fid;
|
||||
fid NumGeometries(g)
|
||||
111 4
|
||||
112 4
|
||||
113 2
|
||||
SELECT fid, NumGeometries(g) from gis_multi_line ORDER by fid;
|
||||
fid NumGeometries(g)
|
||||
114 2
|
||||
115 1
|
||||
116 2
|
||||
SELECT fid, NumGeometries(g) from gis_multi_polygon ORDER by fid;
|
||||
fid NumGeometries(g)
|
||||
117 2
|
||||
118 2
|
||||
119 1
|
||||
SELECT fid, NumGeometries(g) from gis_geometrycollection ORDER by fid;
|
||||
fid NumGeometries(g)
|
||||
120 2
|
||||
121 2
|
||||
explain extended SELECT fid, NumGeometries(g) from gis_multi_point;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
|
||||
Warnings:
|
||||
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,numgeometries(`test`.`gis_multi_point`.`g`) AS `NumGeometries(g)` from `test`.`gis_multi_point`
|
||||
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point ORDER by fid;
|
||||
fid AsText(GeometryN(g, 2))
|
||||
111 POINT(10 10)
|
||||
112 POINT(11 11)
|
||||
113 POINT(4 10)
|
||||
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line ORDER by fid;
|
||||
fid AsText(GeometryN(g, 2))
|
||||
114 LINESTRING(16 0,16 23,16 48)
|
||||
115 NULL
|
||||
116 LINESTRING(2 5,5 8,21 7)
|
||||
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon ORDER by fid;
|
||||
fid AsText(GeometryN(g, 2))
|
||||
117 POLYGON((59 18,67 18,67 13,59 13,59 18))
|
||||
118 POLYGON((59 18,67 18,67 13,59 13,59 18))
|
||||
119 NULL
|
||||
SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection ORDER by fid;
|
||||
fid AsText(GeometryN(g, 2))
|
||||
120 LINESTRING(0 0,10 10)
|
||||
121 LINESTRING(3 6,7 9)
|
||||
SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection ORDER by fid;
|
||||
fid AsText(GeometryN(g, 1))
|
||||
120 POINT(0 0)
|
||||
121 POINT(44 6)
|
||||
explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
|
||||
Warnings:
|
||||
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,astext(geometryn(`test`.`gis_multi_point`.`g`,2)) AS `AsText(GeometryN(g, 2))` from `test`.`gis_multi_point`
|
||||
SELECT g1.fid as first, g2.fid as second,
|
||||
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
|
||||
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
|
||||
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
|
||||
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
||||
first second w c o e d t i r
|
||||
120 120 1 1 0 1 0 0 1 0
|
||||
120 121 0 0 1 0 0 0 1 0
|
||||
121 120 0 0 1 0 0 0 1 0
|
||||
121 121 1 1 0 1 0 0 1 0
|
||||
explain extended SELECT g1.fid as first, g2.fid as second,
|
||||
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
|
||||
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
|
||||
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
|
||||
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE g1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
|
||||
1 SIMPLE g2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer
|
||||
Warnings:
|
||||
Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,within(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,contains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,overlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,equals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,disjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,intersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid`
|
||||
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
|
||||
CREATE TABLE t1 (
|
||||
a INTEGER PRIMARY KEY AUTO_INCREMENT,
|
||||
gp point,
|
||||
ln linestring,
|
||||
pg polygon,
|
||||
mp multipoint,
|
||||
mln multilinestring,
|
||||
mpg multipolygon,
|
||||
gc geometrycollection,
|
||||
gm geometry
|
||||
);
|
||||
SHOW FIELDS FROM t1;
|
||||
Field Type Null Key Default Extra
|
||||
a int(11) NO PRI NULL auto_increment
|
||||
gp point YES NULL
|
||||
ln linestring YES NULL
|
||||
pg polygon YES NULL
|
||||
mp multipoint YES NULL
|
||||
mln multilinestring YES NULL
|
||||
mpg multipolygon YES NULL
|
||||
gc geometrycollection YES NULL
|
||||
gm geometry YES NULL
|
||||
ALTER TABLE t1 ADD fid INT;
|
||||
SHOW FIELDS FROM t1;
|
||||
Field Type Null Key Default Extra
|
||||
a int(11) NO PRI NULL auto_increment
|
||||
gp point YES NULL
|
||||
ln linestring YES NULL
|
||||
pg polygon YES NULL
|
||||
mp multipoint YES NULL
|
||||
mln multilinestring YES NULL
|
||||
mpg multipolygon YES NULL
|
||||
gc geometrycollection YES NULL
|
||||
gm geometry YES NULL
|
||||
fid int(11) YES NULL
|
||||
DROP TABLE t1;
|
||||
create table t1 (pk integer primary key auto_increment, a geometry not null);
|
||||
insert into t1 (a) values (GeomFromText('Point(1 2)'));
|
||||
insert into t1 (a) values ('Garbage');
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
||||
insert IGNORE into t1 (a) values ('Garbage');
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
||||
drop table t1;
|
||||
create table t1 (pk integer primary key auto_increment, fl geometry not null);
|
||||
insert into t1 (fl) values (1);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
||||
insert into t1 (fl) values (1.11);
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
||||
insert into t1 (fl) values ("qwerty");
|
||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
||||
insert into t1 (fl) values (pointfromtext('point(1,1)'));
|
||||
ERROR 23000: Column 'fl' cannot be null
|
||||
drop table t1;
|
||||
End of 4.1 tests
|
||||
CREATE TABLE t1 (name VARCHAR(100), square GEOMETRY);
|
||||
INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
|
||||
INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
|
||||
INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
|
||||
INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
|
||||
INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
|
||||
INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
|
||||
INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
|
||||
INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
|
||||
INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
|
||||
INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
|
||||
INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
|
||||
INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
|
||||
INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
|
||||
INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
|
||||
INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
mbrcontains
|
||||
center,small
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
mbrdisjoint
|
||||
down3,left3,right3,up3
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
mbrequal
|
||||
center
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
mbrintersect
|
||||
big,center,down,down2,left,left2,right,right2,small,up,up2
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
mbroverlaps
|
||||
down,left,right,up
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
mbrtouches
|
||||
down2,left2,right2,up2
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
mbrwithin
|
||||
big,center
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
contains
|
||||
center,small
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
disjoint
|
||||
down3,left3,right3,up3
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
equals
|
||||
center
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
intersect
|
||||
big,center,down,down2,left,left2,right,right2,small,up,up2
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
overlaps
|
||||
down,left,right,up
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
touches
|
||||
down2,left2,right2,up2
|
||||
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||
within
|
||||
big,center
|
||||
SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
|
||||
SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
|
||||
SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
|
||||
SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
|
||||
SET @point1 = GeomFromText('POLYGON ((0 0))');
|
||||
SET @point2 = GeomFromText('POLYGON ((-2 0))');
|
||||
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
|
||||
overlaps
|
||||
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
|
||||
overlaps
|
||||
SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
|
||||
Overlaps(@horiz1, @vert1)
|
||||
0
|
||||
SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
|
||||
Overlaps(@horiz1, @horiz2)
|
||||
1
|
||||
SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
|
||||
Overlaps(@horiz1, @horiz3)
|
||||
0
|
||||
SELECT Overlaps(@horiz1, @point1) FROM DUAL;
|
||||
Overlaps(@horiz1, @point1)
|
||||
0
|
||||
SELECT Overlaps(@horiz1, @point2) FROM DUAL;
|
||||
Overlaps(@horiz1, @point2)
|
||||
0
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
518
build/lib/mysql/mysql-test/r/auto_increment.result
Normal file
518
build/lib/mysql/mysql-test/r/auto_increment.result
Normal file
@@ -0,0 +1,518 @@
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
SET SQL_WARNINGS=1;
|
||||
create table t1 (a int not null auto_increment,b int, primary key (a)) engine=myisam auto_increment=3;
|
||||
insert into t1 values (1,1),(NULL,3),(NULL,4);
|
||||
delete from t1 where a=4;
|
||||
insert into t1 values (NULL,5),(NULL,6);
|
||||
select * from t1;
|
||||
a b
|
||||
1 1
|
||||
3 3
|
||||
5 5
|
||||
6 6
|
||||
delete from t1 where a=6;
|
||||
replace t1 values (3,1);
|
||||
ALTER TABLE t1 add c int;
|
||||
replace t1 values (3,3,3);
|
||||
insert into t1 values (NULL,7,7);
|
||||
update t1 set a=8,b=b+1,c=c+1 where a=7;
|
||||
insert into t1 values (NULL,9,9);
|
||||
select * from t1;
|
||||
a b c
|
||||
1 1 NULL
|
||||
3 3 3
|
||||
5 5 NULL
|
||||
8 8 8
|
||||
9 9 9
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
skey tinyint unsigned NOT NULL auto_increment PRIMARY KEY,
|
||||
sval char(20)
|
||||
);
|
||||
insert into t1 values (NULL, "hello");
|
||||
insert into t1 values (NULL, "hey");
|
||||
select * from t1;
|
||||
skey sval
|
||||
1 hello
|
||||
2 hey
|
||||
select _rowid,t1._rowid,skey,sval from t1;
|
||||
_rowid _rowid skey sval
|
||||
1 1 1 hello
|
||||
2 2 2 hey
|
||||
drop table t1;
|
||||
create table t1 (a char(10) not null, b int not null auto_increment, primary key(a,b));
|
||||
insert into t1 values ("a",1),("b",2),("a",2),("c",1);
|
||||
insert into t1 values ("a",NULL),("b",NULL),("c",NULL),("e",NULL);
|
||||
insert into t1 (a) values ("a"),("b"),("c"),("d");
|
||||
insert into t1 (a) values ('k'),('d');
|
||||
insert into t1 (a) values ("a");
|
||||
insert into t1 values ("d",last_insert_id());
|
||||
select * from t1;
|
||||
a b
|
||||
a 1
|
||||
a 2
|
||||
a 3
|
||||
a 4
|
||||
a 5
|
||||
b 2
|
||||
b 3
|
||||
b 4
|
||||
c 1
|
||||
c 2
|
||||
c 3
|
||||
d 1
|
||||
d 2
|
||||
d 5
|
||||
e 1
|
||||
k 1
|
||||
drop table t1;
|
||||
create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ordid), index(ord,ordid));
|
||||
insert into t1 (ordid,ord) values (NULL,'sdj'),(NULL,'sdj');
|
||||
select * from t1;
|
||||
ordid ord
|
||||
1 sdj
|
||||
2 sdj
|
||||
drop table t1;
|
||||
create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid));
|
||||
insert into t1 values (NULL,'sdj'),(NULL,'sdj'),(NULL,"abc"),(NULL,'abc'),(NULL,'zzz'),(NULL,'sdj'),(NULL,'abc');
|
||||
select * from t1;
|
||||
ordid ord
|
||||
1 abc
|
||||
2 abc
|
||||
3 abc
|
||||
1 sdj
|
||||
2 sdj
|
||||
3 sdj
|
||||
1 zzz
|
||||
drop table t1;
|
||||
create table t1 (sid char(5), id int(2) NOT NULL auto_increment, key(sid, id));
|
||||
create table t2 (sid char(20), id int(2));
|
||||
insert into t2 values ('skr',NULL),('skr',NULL),('test',NULL);
|
||||
insert into t1 select * from t2;
|
||||
select * from t1;
|
||||
sid id
|
||||
skr 1
|
||||
skr 2
|
||||
test 1
|
||||
drop table t1,t2;
|
||||
create table t1 (a int not null primary key auto_increment);
|
||||
insert into t1 values (0);
|
||||
update t1 set a=0;
|
||||
select * from t1;
|
||||
a
|
||||
0
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check warning Found row where the auto_increment column has the value 0
|
||||
test.t1 check status OK
|
||||
drop table t1;
|
||||
create table t1 (a int not null auto_increment primary key);
|
||||
insert into t1 values (NULL);
|
||||
insert into t1 values (-1);
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
1
|
||||
insert into t1 values (NULL);
|
||||
select * from t1;
|
||||
a
|
||||
-1
|
||||
1
|
||||
2
|
||||
drop table t1;
|
||||
create table t1 (a int not null auto_increment primary key) /*!40102 engine=heap */;
|
||||
insert into t1 values (NULL);
|
||||
insert into t1 values (-1);
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
1
|
||||
insert into t1 values (NULL);
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
-1
|
||||
2
|
||||
drop table t1;
|
||||
create table t1 (i tinyint unsigned not null auto_increment primary key);
|
||||
insert into t1 set i = 254;
|
||||
insert into t1 set i = null;
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
255
|
||||
explain extended select last_insert_id();
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select last_insert_id() AS `last_insert_id()`
|
||||
insert into t1 set i = 254;
|
||||
ERROR 23000: Duplicate entry '254' for key 'PRIMARY'
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
255
|
||||
insert into t1 set i = null;
|
||||
ERROR 23000: Duplicate entry '255' for key 'PRIMARY'
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
255
|
||||
drop table t1;
|
||||
create table t1 (i tinyint unsigned not null auto_increment, key (i));
|
||||
insert into t1 set i = 254;
|
||||
insert into t1 set i = null;
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
255
|
||||
insert into t1 set i = null;
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'i' at row 1
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
255
|
||||
drop table t1;
|
||||
create table t1 (i tinyint unsigned not null auto_increment primary key, b int, unique (b));
|
||||
insert into t1 values (NULL, 10);
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
1
|
||||
insert into t1 values (NULL, 15);
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
2
|
||||
insert into t1 values (NULL, 10);
|
||||
ERROR 23000: Duplicate entry '10' for key 'b'
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
2
|
||||
drop table t1;
|
||||
create table t1(a int auto_increment,b int null,primary key(a));
|
||||
SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
|
||||
insert into t1(a,b)values(NULL,1);
|
||||
insert into t1(a,b)values(200,2);
|
||||
insert into t1(a,b)values(0,3);
|
||||
insert into t1(b)values(4);
|
||||
insert into t1(b)values(5);
|
||||
insert into t1(b)values(6);
|
||||
insert into t1(b)values(7);
|
||||
select * from t1 order by b;
|
||||
a b
|
||||
1 1
|
||||
200 2
|
||||
0 3
|
||||
201 4
|
||||
202 5
|
||||
203 6
|
||||
204 7
|
||||
alter table t1 modify b mediumint;
|
||||
select * from t1 order by b;
|
||||
a b
|
||||
1 1
|
||||
200 2
|
||||
0 3
|
||||
201 4
|
||||
202 5
|
||||
203 6
|
||||
204 7
|
||||
create table t2 (a int);
|
||||
insert t2 values (1),(2);
|
||||
alter table t2 add b int auto_increment primary key;
|
||||
select * from t2;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
drop table t2;
|
||||
delete from t1 where a=0;
|
||||
update t1 set a=0 where b=5;
|
||||
select * from t1 order by b;
|
||||
a b
|
||||
1 1
|
||||
200 2
|
||||
201 4
|
||||
0 5
|
||||
203 6
|
||||
204 7
|
||||
delete from t1 where a=0;
|
||||
update t1 set a=NULL where b=6;
|
||||
Warnings:
|
||||
Warning 1048 Column 'a' cannot be null
|
||||
update t1 set a=300 where b=7;
|
||||
SET SQL_MODE='';
|
||||
insert into t1(a,b)values(NULL,8);
|
||||
insert into t1(a,b)values(400,9);
|
||||
insert into t1(a,b)values(0,10);
|
||||
insert into t1(b)values(11);
|
||||
insert into t1(b)values(12);
|
||||
insert into t1(b)values(13);
|
||||
insert into t1(b)values(14);
|
||||
select * from t1 order by b;
|
||||
a b
|
||||
1 1
|
||||
200 2
|
||||
201 4
|
||||
0 6
|
||||
300 7
|
||||
301 8
|
||||
400 9
|
||||
401 10
|
||||
402 11
|
||||
403 12
|
||||
404 13
|
||||
405 14
|
||||
delete from t1 where a=0;
|
||||
update t1 set a=0 where b=12;
|
||||
select * from t1 order by b;
|
||||
a b
|
||||
1 1
|
||||
200 2
|
||||
201 4
|
||||
300 7
|
||||
301 8
|
||||
400 9
|
||||
401 10
|
||||
402 11
|
||||
0 12
|
||||
404 13
|
||||
405 14
|
||||
delete from t1 where a=0;
|
||||
update t1 set a=NULL where b=13;
|
||||
Warnings:
|
||||
Warning 1048 Column 'a' cannot be null
|
||||
update t1 set a=500 where b=14;
|
||||
select * from t1 order by b;
|
||||
a b
|
||||
1 1
|
||||
200 2
|
||||
201 4
|
||||
300 7
|
||||
301 8
|
||||
400 9
|
||||
401 10
|
||||
402 11
|
||||
0 13
|
||||
500 14
|
||||
drop table t1;
|
||||
create table t1 (a bigint);
|
||||
insert into t1 values (1), (2), (3), (NULL), (NULL);
|
||||
alter table t1 modify a bigint not null auto_increment primary key;
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
drop table t1;
|
||||
create table t1 (a bigint);
|
||||
insert into t1 values (1), (2), (3), (0), (0);
|
||||
alter table t1 modify a bigint not null auto_increment primary key;
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
drop table t1;
|
||||
create table t1 (a bigint);
|
||||
insert into t1 values (0), (1), (2), (3);
|
||||
set sql_mode=NO_AUTO_VALUE_ON_ZERO;
|
||||
alter table t1 modify a bigint not null auto_increment primary key;
|
||||
set sql_mode= '';
|
||||
select * from t1;
|
||||
a
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
drop table t1;
|
||||
create table t1 (a int auto_increment primary key , b int null);
|
||||
set sql_mode=NO_AUTO_VALUE_ON_ZERO;
|
||||
insert into t1 values (0,1),(1,2),(2,3);
|
||||
select * from t1;
|
||||
a b
|
||||
0 1
|
||||
1 2
|
||||
2 3
|
||||
set sql_mode= '';
|
||||
alter table t1 modify b varchar(255);
|
||||
insert into t1 values (0,4);
|
||||
select * from t1;
|
||||
a b
|
||||
0 1
|
||||
1 2
|
||||
2 3
|
||||
3 4
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( a INT AUTO_INCREMENT, b BLOB, PRIMARY KEY (a,b(10)));
|
||||
INSERT INTO t1 (b) VALUES ('aaaa');
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
INSERT INTO t1 (b) VALUES ('');
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
INSERT INTO t1 (b) VALUES ('bbbb');
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE `t1` (
|
||||
t1_name VARCHAR(255) DEFAULT NULL,
|
||||
t1_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
KEY (t1_name),
|
||||
PRIMARY KEY (t1_id)
|
||||
) AUTO_INCREMENT = 1000;
|
||||
INSERT INTO t1 (t1_name) VALUES('MySQL');
|
||||
INSERT INTO t1 (t1_name) VALUES('MySQL');
|
||||
INSERT INTO t1 (t1_name) VALUES('MySQL');
|
||||
SELECT * from t1;
|
||||
t1_name t1_id
|
||||
MySQL 1000
|
||||
MySQL 1001
|
||||
MySQL 1002
|
||||
SHOW CREATE TABLE `t1`;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`t1_name` varchar(255) DEFAULT NULL,
|
||||
`t1_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`t1_id`),
|
||||
KEY `t1_name` (`t1_name`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1
|
||||
DROP TABLE `t1`;
|
||||
create table t1(a int not null auto_increment primary key);
|
||||
create table t2(a int not null auto_increment primary key, t1a int);
|
||||
insert into t1 values(NULL);
|
||||
insert into t2 values (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID());
|
||||
insert into t1 values (NULL);
|
||||
insert into t2 values (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID()),
|
||||
(NULL, LAST_INSERT_ID());
|
||||
insert into t1 values (NULL);
|
||||
insert into t2 values (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID()),
|
||||
(NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID());
|
||||
select * from t2;
|
||||
a t1a
|
||||
1 1
|
||||
2 1
|
||||
3 2
|
||||
4 2
|
||||
5 2
|
||||
6 3
|
||||
7 3
|
||||
8 3
|
||||
9 3
|
||||
drop table t1, t2;
|
||||
End of 4.1 tests
|
||||
CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`));
|
||||
insert into t1 (b) values (1);
|
||||
replace into t1 (b) values (2), (1), (3);
|
||||
select * from t1;
|
||||
a b
|
||||
3 1
|
||||
2 2
|
||||
4 3
|
||||
truncate table t1;
|
||||
insert into t1 (b) values (1);
|
||||
replace into t1 (b) values (2);
|
||||
replace into t1 (b) values (1);
|
||||
replace into t1 (b) values (3);
|
||||
select * from t1;
|
||||
a b
|
||||
3 1
|
||||
2 2
|
||||
4 3
|
||||
drop table t1;
|
||||
create table t1 (rowid int not null auto_increment, val int not null,primary
|
||||
key (rowid), unique(val));
|
||||
replace into t1 (val) values ('1'),('2');
|
||||
replace into t1 (val) values ('1'),('2');
|
||||
insert into t1 (val) values ('1'),('2');
|
||||
ERROR 23000: Duplicate entry '1' for key 'val'
|
||||
select * from t1;
|
||||
rowid val
|
||||
3 1
|
||||
4 2
|
||||
drop table t1;
|
||||
create table t1 (a int not null auto_increment primary key, val int);
|
||||
insert into t1 (val) values (1);
|
||||
update t1 set a=2 where a=1;
|
||||
insert into t1 (val) values (1);
|
||||
select * from t1;
|
||||
a val
|
||||
2 1
|
||||
3 1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (t1 INT(10) PRIMARY KEY, t2 INT(10));
|
||||
INSERT INTO t1 VALUES(0, 0);
|
||||
INSERT INTO t1 VALUES(1, 1);
|
||||
ALTER TABLE t1 CHANGE t1 t1 INT(10) auto_increment;
|
||||
ERROR 23000: ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '1' for key 'PRIMARY'
|
||||
DROP TABLE t1;
|
||||
create table t1 (a int primary key auto_increment, b int, c int, d timestamp default current_timestamp, unique(b),unique(c));
|
||||
insert into t1 values(null,1,1,now());
|
||||
insert into t1 values(null,0,0,null);
|
||||
replace into t1 values(null,1,0,null);
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
3
|
||||
drop table t1;
|
||||
create table t1 (a int primary key auto_increment, b int, c int, e int, d timestamp default current_timestamp, unique(b),unique(c),unique(e));
|
||||
insert into t1 values(null,1,1,1,now());
|
||||
insert into t1 values(null,0,0,0,null);
|
||||
replace into t1 values(null,1,0,2,null);
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
3
|
||||
drop table t1;
|
||||
#
|
||||
# Bug#46616: Assertion `!table->auto_increment_field_not_null' on view
|
||||
# manipulations
|
||||
#
|
||||
CREATE TABLE t1 ( a INT );
|
||||
INSERT INTO t1 VALUES (1), (1);
|
||||
CREATE TABLE t2 ( a INT AUTO_INCREMENT KEY );
|
||||
CREATE TABLE IF NOT EXISTS t2 AS SELECT a FROM t1;
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
UPDATE t2 SET a = 2;
|
||||
SELECT a FROM t2;
|
||||
a
|
||||
2
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# Bug#39828 autoinc wraps around when offset and increment > 1
|
||||
#
|
||||
CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) engine=MyISAM;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
INSERT INTO t1 VALUES (18446744073709551601);
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=10;
|
||||
SELECT @@SESSION.AUTO_INCREMENT_OFFSET;
|
||||
@@SESSION.AUTO_INCREMENT_OFFSET
|
||||
1
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
ERROR 22003: Out of range value for column 't1' at row 167
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1
|
||||
18446744073709551601
|
||||
18446744073709551611
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=default;
|
||||
SET @@SESSION.AUTO_INCREMENT_OFFSET=default;
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
#
|
||||
# Bug#50619 assert in handler::update_auto_increment
|
||||
#
|
||||
CREATE TABLE t1 (pk INT AUTO_INCREMENT, PRIMARY KEY (pk));
|
||||
INSERT INTO t1 VALUES (NULL), (-1), (NULL);
|
||||
SELECT * FROM t1;
|
||||
pk
|
||||
-1
|
||||
1
|
||||
2
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (pk BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY (pk));
|
||||
INSERT INTO t1 VALUES (NULL), (18446744073709551615-1), (NULL);
|
||||
ERROR HY000: Failed to read auto-increment value from storage engine
|
||||
SELECT * FROM t1;
|
||||
pk
|
||||
1
|
||||
18446744073709551614
|
||||
DROP TABLE t1;
|
||||
111
build/lib/mysql/mysql-test/r/backup.result
Normal file
111
build/lib/mysql/mysql-test/r/backup.result
Normal file
@@ -0,0 +1,111 @@
|
||||
set SQL_LOG_BIN=0;
|
||||
drop table if exists t1, t2, t3, t4;
|
||||
create table t4(n int);
|
||||
backup table t4 to '../../bogus';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t4 backup error Failed copying .frm file (errno: X)
|
||||
test.t4 backup Warning 'BACKUP TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t4 backup Error Can't create/write to file 'MYSQLTEST_VARDIR/bogus/t4.frm' (Errcode: X)
|
||||
test.t4 backup status Operation failed
|
||||
backup table t4 to '../../tmp';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t4 backup Warning 'BACKUP TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t4 backup status OK
|
||||
backup table t4 to '../../tmp';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t4 backup error Failed copying .frm file (errno: X)
|
||||
test.t4 backup Warning 'BACKUP TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t4 backup Error Can't create/write to file 'MYSQLTEST_VARDIR/tmp/t4.frm' (Errcode: X)
|
||||
test.t4 backup status Operation failed
|
||||
drop table t4;
|
||||
restore table t4 from '../../tmp';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t4 restore Warning 'RESTORE TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t4 restore status OK
|
||||
select count(*) from t4;
|
||||
count(*)
|
||||
0
|
||||
create table t1(n int);
|
||||
insert into t1 values (23),(45),(67);
|
||||
backup table t1 to '../../tmp';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 backup Warning 'BACKUP TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t1 backup status OK
|
||||
drop table t1;
|
||||
restore table t1 from '../../bogus';
|
||||
Table Op Msg_type Msg_text
|
||||
t1 restore error Failed copying .frm file
|
||||
Warnings:
|
||||
Warning 1287 'RESTORE TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
Error 29 File 'MYSQLTEST_VARDIR/bogus/t1.frm' not found (Errcode: X)
|
||||
restore table t1 from '../../tmp';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 restore Warning 'RESTORE TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t1 restore status OK
|
||||
select n from t1;
|
||||
n
|
||||
23
|
||||
45
|
||||
67
|
||||
create table t2(m int not null primary key);
|
||||
create table t3(k int not null primary key);
|
||||
insert into t2 values (123),(145),(167);
|
||||
insert into t3 values (223),(245),(267);
|
||||
backup table t2,t3 to '../../tmp';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t2 backup Warning 'BACKUP TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t2 backup status OK
|
||||
test.t3 backup status OK
|
||||
drop table t1,t2,t3;
|
||||
restore table t1,t2,t3 from '../../tmp';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 restore Warning 'RESTORE TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t1 restore status OK
|
||||
test.t2 restore status OK
|
||||
test.t3 restore status OK
|
||||
select n from t1;
|
||||
n
|
||||
23
|
||||
45
|
||||
67
|
||||
select m from t2;
|
||||
m
|
||||
123
|
||||
145
|
||||
167
|
||||
select k from t3;
|
||||
k
|
||||
223
|
||||
245
|
||||
267
|
||||
drop table t1,t2,t3,t4;
|
||||
restore table t1 from '../../tmp';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 restore Warning 'RESTORE TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t1 restore status OK
|
||||
rename table t1 to t5;
|
||||
lock tables t5 write;
|
||||
backup table t5 to '../../tmp';
|
||||
unlock tables;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t5 backup Warning 'BACKUP TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t5 backup status OK
|
||||
drop table t5;
|
||||
DROP TABLE IF EXISTS `t+1`;
|
||||
CREATE TABLE `t+1` (c1 INT);
|
||||
INSERT INTO `t+1` VALUES (1), (2), (3);
|
||||
BACKUP TABLE `t+1` TO '../../tmp';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t+1 backup Warning 'BACKUP TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t+1 backup status OK
|
||||
DROP TABLE `t+1`;
|
||||
RESTORE TABLE `t+1` FROM '../../tmp';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t+1 restore Warning 'RESTORE TABLE' is deprecated and will be removed in a future release. Please use MySQL Administrator (mysqldump, mysql) instead
|
||||
test.t+1 restore status OK
|
||||
SELECT * FROM `t+1`;
|
||||
c1
|
||||
1
|
||||
2
|
||||
3
|
||||
DROP TABLE `t+1`;
|
||||
11
build/lib/mysql/mysql-test/r/bench_count_distinct.result
Normal file
11
build/lib/mysql/mysql-test/r/bench_count_distinct.result
Normal file
@@ -0,0 +1,11 @@
|
||||
drop table if exists t1;
|
||||
create table t1(n int not null, key(n)) delay_key_write = 1;
|
||||
select count(distinct n) from t1;
|
||||
count(distinct n)
|
||||
100
|
||||
explain extended select count(distinct n) from t1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 index NULL n 4 NULL 200 100.00 Using index
|
||||
Warnings:
|
||||
Note 1003 select count(distinct `test`.`t1`.`n`) AS `count(distinct n)` from `test`.`t1`
|
||||
drop table t1;
|
||||
2
build/lib/mysql/mysql-test/r/big_test.require
Normal file
2
build/lib/mysql/mysql-test/r/big_test.require
Normal file
@@ -0,0 +1,2 @@
|
||||
using_big_test
|
||||
1
|
||||
440
build/lib/mysql/mysql-test/r/bigint.result
Normal file
440
build/lib/mysql/mysql-test/r/bigint.result
Normal file
@@ -0,0 +1,440 @@
|
||||
drop table if exists t1, t2;
|
||||
select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296;
|
||||
0 256 00000000000000065536 2147483647 -2147483648 2147483648 4294967296
|
||||
0 256 65536 2147483647 -2147483648 2147483648 4294967296
|
||||
select 9223372036854775807,-009223372036854775808;
|
||||
9223372036854775807 -009223372036854775808
|
||||
9223372036854775807 -9223372036854775808
|
||||
select +9999999999999999999,-9999999999999999999;
|
||||
9999999999999999999 -9999999999999999999
|
||||
9999999999999999999 -9999999999999999999
|
||||
select cast(9223372036854775808 as unsigned)+1;
|
||||
cast(9223372036854775808 as unsigned)+1
|
||||
9223372036854775809
|
||||
select 9223372036854775808+1;
|
||||
9223372036854775808+1
|
||||
9223372036854775809
|
||||
select -(0-3),round(-(0-3)), round(9999999999999999999);
|
||||
-(0-3) round(-(0-3)) round(9999999999999999999)
|
||||
3 3 9999999999999999999
|
||||
select 1,11,101,1001,10001,100001,1000001,10000001,100000001,1000000001,10000000001,100000000001,1000000000001,10000000000001,100000000000001,1000000000000001,10000000000000001,100000000000000001,1000000000000000001,10000000000000000001;
|
||||
1 11 101 1001 10001 100001 1000001 10000001 100000001 1000000001 10000000001 100000000001 1000000000001 10000000000001 100000000000001 1000000000000001 10000000000000001 100000000000000001 1000000000000000001 10000000000000000001
|
||||
1 11 101 1001 10001 100001 1000001 10000001 100000001 1000000001 10000000001 100000000001 1000000000001 10000000000001 100000000000001 1000000000000001 10000000000000001 100000000000000001 1000000000000000001 10000000000000000001
|
||||
select -1,-11,-101,-1001,-10001,-100001,-1000001,-10000001,-100000001,-1000000001,-10000000001,-100000000001,-1000000000001,-10000000000001,-100000000000001,-1000000000000001,-10000000000000001,-100000000000000001,-1000000000000000001,-10000000000000000001;
|
||||
-1 -11 -101 -1001 -10001 -100001 -1000001 -10000001 -100000001 -1000000001 -10000000001 -100000000001 -1000000000001 -10000000000001 -100000000000001 -1000000000000001 -10000000000000001 -100000000000000001 -1000000000000000001 -10000000000000000001
|
||||
-1 -11 -101 -1001 -10001 -100001 -1000001 -10000001 -100000001 -1000000001 -10000000001 -100000000001 -1000000000001 -10000000000001 -100000000000001 -1000000000000001 -10000000000000001 -100000000000000001 -1000000000000000001 -10000000000000000001
|
||||
select conv(1,10,16),conv((1<<2)-1,10,16),conv((1<<10)-2,10,16),conv((1<<16)-3,10,16),conv((1<<25)-4,10,16),conv((1<<31)-5,10,16),conv((1<<36)-6,10,16),conv((1<<47)-7,10,16),conv((1<<48)-8,10,16),conv((1<<55)-9,10,16),conv((1<<56)-10,10,16),conv((1<<63)-11,10,16);
|
||||
conv(1,10,16) conv((1<<2)-1,10,16) conv((1<<10)-2,10,16) conv((1<<16)-3,10,16) conv((1<<25)-4,10,16) conv((1<<31)-5,10,16) conv((1<<36)-6,10,16) conv((1<<47)-7,10,16) conv((1<<48)-8,10,16) conv((1<<55)-9,10,16) conv((1<<56)-10,10,16) conv((1<<63)-11,10,16)
|
||||
1 3 3FE FFFD 1FFFFFC 7FFFFFFB FFFFFFFFA 7FFFFFFFFFF9 FFFFFFFFFFF8 7FFFFFFFFFFFF7 FFFFFFFFFFFFF6 7FFFFFFFFFFFFFF5
|
||||
create table t1 (a bigint unsigned not null, primary key(a));
|
||||
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
|
||||
select * from t1;
|
||||
a
|
||||
18446744073709551612
|
||||
18446744073709551613
|
||||
18446744073709551614
|
||||
18446744073709551615
|
||||
select * from t1 where a=18446744073709551615;
|
||||
a
|
||||
18446744073709551615
|
||||
delete from t1 where a=18446744073709551615;
|
||||
select * from t1;
|
||||
a
|
||||
18446744073709551612
|
||||
18446744073709551613
|
||||
18446744073709551614
|
||||
drop table t1;
|
||||
create table t1 ( a int not null default 1, big bigint );
|
||||
insert into t1 (big) values (-1),(12345678901234567),(9223372036854775807),(18446744073709551615);
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'big' at row 4
|
||||
select * from t1;
|
||||
a big
|
||||
1 -1
|
||||
1 12345678901234567
|
||||
1 9223372036854775807
|
||||
1 9223372036854775807
|
||||
select min(big),max(big),max(big)-1 from t1;
|
||||
min(big) max(big) max(big)-1
|
||||
-1 9223372036854775807 9223372036854775806
|
||||
select min(big),max(big),max(big)-1 from t1 group by a;
|
||||
min(big) max(big) max(big)-1
|
||||
-1 9223372036854775807 9223372036854775806
|
||||
alter table t1 modify big bigint unsigned not null;
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'big' at row 1
|
||||
select min(big),max(big),max(big)-1 from t1;
|
||||
min(big) max(big) max(big)-1
|
||||
0 9223372036854775807 9223372036854775806
|
||||
select min(big),max(big),max(big)-1 from t1 group by a;
|
||||
min(big) max(big) max(big)-1
|
||||
0 9223372036854775807 9223372036854775806
|
||||
insert into t1 (big) values (18446744073709551615);
|
||||
select * from t1;
|
||||
a big
|
||||
1 0
|
||||
1 12345678901234567
|
||||
1 9223372036854775807
|
||||
1 9223372036854775807
|
||||
1 18446744073709551615
|
||||
select min(big),max(big),max(big)-1 from t1;
|
||||
min(big) max(big) max(big)-1
|
||||
0 18446744073709551615 18446744073709551614
|
||||
select min(big),max(big),max(big)-1 from t1 group by a;
|
||||
min(big) max(big) max(big)-1
|
||||
0 18446744073709551615 18446744073709551614
|
||||
alter table t1 add key (big);
|
||||
select min(big),max(big),max(big)-1 from t1;
|
||||
min(big) max(big) max(big)-1
|
||||
0 18446744073709551615 18446744073709551614
|
||||
select min(big),max(big),max(big)-1 from t1 group by a;
|
||||
min(big) max(big) max(big)-1
|
||||
0 18446744073709551615 18446744073709551614
|
||||
alter table t1 modify big bigint not null;
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'big' at row 5
|
||||
select * from t1;
|
||||
a big
|
||||
1 0
|
||||
1 12345678901234567
|
||||
1 9223372036854775807
|
||||
1 9223372036854775807
|
||||
1 9223372036854775807
|
||||
select min(big),max(big),max(big)-1 from t1;
|
||||
min(big) max(big) max(big)-1
|
||||
0 9223372036854775807 9223372036854775806
|
||||
select min(big),max(big),max(big)-1 from t1 group by a;
|
||||
min(big) max(big) max(big)-1
|
||||
0 9223372036854775807 9223372036854775806
|
||||
drop table t1;
|
||||
create table t1 (id bigint auto_increment primary key, a int) auto_increment=9999999999;
|
||||
insert into t1 values (null,1);
|
||||
select * from t1;
|
||||
id a
|
||||
9999999999 1
|
||||
select * from t1 limit 9999999999;
|
||||
id a
|
||||
9999999999 1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( quantity decimal(60,0));
|
||||
insert into t1 values (10000000000000000000);
|
||||
insert into t1 values (10000000000000000000.0);
|
||||
insert into t1 values ('10000000000000000000');
|
||||
select * from t1;
|
||||
quantity
|
||||
10000000000000000000
|
||||
10000000000000000000
|
||||
10000000000000000000
|
||||
drop table t1;
|
||||
SELECT '0x8000000000000001'+0;
|
||||
'0x8000000000000001'+0
|
||||
0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '0x8000000000000001'
|
||||
create table t1 (
|
||||
value64 bigint unsigned not null,
|
||||
value32 integer not null,
|
||||
primary key(value64, value32)
|
||||
);
|
||||
create table t2 (
|
||||
value64 bigint unsigned not null,
|
||||
value32 integer not null,
|
||||
primary key(value64, value32)
|
||||
);
|
||||
insert into t1 values(17156792991891826145, 1);
|
||||
insert into t1 values( 9223372036854775807, 2);
|
||||
insert into t2 values(17156792991891826145, 3);
|
||||
insert into t2 values( 9223372036854775807, 4);
|
||||
select * from t1;
|
||||
value64 value32
|
||||
9223372036854775807 2
|
||||
17156792991891826145 1
|
||||
select * from t2;
|
||||
value64 value32
|
||||
9223372036854775807 4
|
||||
17156792991891826145 3
|
||||
select * from t1, t2 where t1.value64=17156792991891826145 and
|
||||
t2.value64=17156792991891826145;
|
||||
value64 value32 value64 value32
|
||||
17156792991891826145 1 17156792991891826145 3
|
||||
select * from t1, t2 where t1.value64=17156792991891826145 and
|
||||
t2.value64=t1.value64;
|
||||
value64 value32 value64 value32
|
||||
17156792991891826145 1 17156792991891826145 3
|
||||
select * from t1, t2 where t1.value64= 9223372036854775807 and
|
||||
t2.value64=9223372036854775807;
|
||||
value64 value32 value64 value32
|
||||
9223372036854775807 2 9223372036854775807 4
|
||||
select * from t1, t2 where t1.value64= 9223372036854775807 and
|
||||
t2.value64=t1.value64;
|
||||
value64 value32 value64 value32
|
||||
9223372036854775807 2 9223372036854775807 4
|
||||
drop table t1, t2;
|
||||
create table t1 (sint64 bigint not null);
|
||||
insert into t1 values (-9223372036854775808);
|
||||
select * from t1;
|
||||
sint64
|
||||
-9223372036854775808
|
||||
drop table t1;
|
||||
create table t1 select 1 as 'a';
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(1) NOT NULL DEFAULT '0'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 select 9223372036854775809 as 'a';
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` bigint(19) unsigned NOT NULL DEFAULT '0'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
select * from t1;
|
||||
a
|
||||
9223372036854775809
|
||||
drop table t1;
|
||||
DROP DATABASE IF EXISTS `scott`;
|
||||
Warnings:
|
||||
Note 1008 Can't drop database 'scott'; database doesn't exist
|
||||
create table t1 (a char(100), b varchar(100), c text, d blob);
|
||||
insert into t1 values(
|
||||
18446744073709551615,18446744073709551615,
|
||||
18446744073709551615, 18446744073709551615
|
||||
);
|
||||
insert into t1 values (-1 | 0,-1 | 0,-1 | 0 ,-1 | 0);
|
||||
select * from t1;
|
||||
a b c d
|
||||
18446744073709551615 18446744073709551615 18446744073709551615 18446744073709551615
|
||||
18446744073709551615 18446744073709551615 18446744073709551615 18446744073709551615
|
||||
drop table t1;
|
||||
create table t1 ( quantity decimal(2) unsigned);
|
||||
insert into t1 values (500), (-500), (~0), (-1);
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'quantity' at row 1
|
||||
Warning 1264 Out of range value for column 'quantity' at row 2
|
||||
Warning 1264 Out of range value for column 'quantity' at row 3
|
||||
Warning 1264 Out of range value for column 'quantity' at row 4
|
||||
select * from t1;
|
||||
quantity
|
||||
99
|
||||
0
|
||||
99
|
||||
0
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
`col1` INT(1) NULL,
|
||||
`col2` INT(2) NULL,
|
||||
`col3` INT(3) NULL,
|
||||
`col4` INT(4) NULL,
|
||||
`col5` INT(5) NULL,
|
||||
`col6` INT(6) NULL,
|
||||
`col7` INT(7) NULL,
|
||||
`col8` INT(8) NULL,
|
||||
`col9` INT(9) NULL,
|
||||
`col10` BIGINT(10) NULL,
|
||||
`col11` BIGINT(11) NULL,
|
||||
`col12` BIGINT(12) NULL,
|
||||
`col13` BIGINT(13) NULL,
|
||||
`col14` BIGINT(14) NULL,
|
||||
`col15` BIGINT(15) NULL,
|
||||
`col16` BIGINT(16) NULL,
|
||||
`col17` BIGINT(17) NULL,
|
||||
`col18` BIGINT(18) NULL,
|
||||
`col19` DECIMAL(19, 0) NULL,
|
||||
`col20` DECIMAL(20, 0) NULL,
|
||||
`col21` DECIMAL(21, 0) NULL,
|
||||
`col22` DECIMAL(22, 0) NULL,
|
||||
`col23` DECIMAL(23, 0) NULL,
|
||||
`col24` DECIMAL(24, 0) NULL,
|
||||
`col25` DECIMAL(25, 0) NULL,
|
||||
`col26` DECIMAL(26, 0) NULL,
|
||||
`col27` DECIMAL(27, 0) NULL,
|
||||
`col28` DECIMAL(28, 0) NULL,
|
||||
`col29` DECIMAL(29, 0) NULL,
|
||||
`col30` DECIMAL(30, 0) NULL,
|
||||
`col31` DECIMAL(31, 0) NULL,
|
||||
`col32` DECIMAL(32, 0) NULL,
|
||||
`col33` DECIMAL(33, 0) NULL,
|
||||
`col34` DECIMAL(34, 0) NULL,
|
||||
`col35` DECIMAL(35, 0) NULL,
|
||||
`col36` DECIMAL(36, 0) NULL,
|
||||
`col37` DECIMAL(37, 0) NULL,
|
||||
`col38` DECIMAL(38, 0) NULL,
|
||||
`fix1` DECIMAL(38, 1) NULL,
|
||||
`fix2` DECIMAL(38, 2) NULL,
|
||||
`fix3` DECIMAL(38, 3) NULL,
|
||||
`fix4` DECIMAL(38, 4) NULL,
|
||||
`fix5` DECIMAL(38, 5) NULL,
|
||||
`fix6` DECIMAL(38, 6) NULL,
|
||||
`fix7` DECIMAL(38, 7) NULL,
|
||||
`fix8` DECIMAL(38, 8) NULL,
|
||||
`fix9` DECIMAL(38, 9) NULL,
|
||||
`fix10` DECIMAL(38, 10) NULL,
|
||||
`fix11` DECIMAL(38, 11) NULL,
|
||||
`fix12` DECIMAL(38, 12) NULL,
|
||||
`fix13` DECIMAL(38, 13) NULL,
|
||||
`fix14` DECIMAL(38, 14) NULL,
|
||||
`fix15` DECIMAL(38, 15) NULL,
|
||||
`fix16` DECIMAL(38, 16) NULL,
|
||||
`fix17` DECIMAL(38, 17) NULL,
|
||||
`fix18` DECIMAL(38, 18) NULL,
|
||||
`fix19` DECIMAL(38, 19) NULL,
|
||||
`fix20` DECIMAL(38, 20) NULL,
|
||||
`fix21` DECIMAL(38, 21) NULL,
|
||||
`fix22` DECIMAL(38, 22) NULL,
|
||||
`fix23` DECIMAL(38, 23) NULL,
|
||||
`fix24` DECIMAL(38, 24) NULL,
|
||||
`fix25` DECIMAL(38, 25) NULL,
|
||||
`fix26` DECIMAL(38, 26) NULL,
|
||||
`fix27` DECIMAL(38, 27) NULL,
|
||||
`fix28` DECIMAL(38, 28) NULL,
|
||||
`fix29` DECIMAL(38, 29) NULL,
|
||||
`fix30` DECIMAL(38, 30) NULL
|
||||
);
|
||||
INSERT INTO t1(`col1`, `col2`, `col3`, `col4`, `col5`, `col6`, `col7`, `col8`, `col9`, `col10`, `col11`, `col12`, `col13`, `col14`, `col15`, `col16`, `col17`, `col18`, `col19`, `col20`, `col21`, `col22`, `col23`, `col24`, `col25`, `col26`, `col27`, `col28`, `col29`, `col30`, `col31`, `col32`, `col33`, `col34`, `col35`, `col36`, `col37`, `col38`, `fix1`, `fix2`, `fix3`, `fix4`, `fix5`, `fix6`, `fix7`, `fix8`, `fix9`, `fix10`, `fix11`, `fix12`, `fix13`, `fix14`, `fix15`, `fix16`, `fix17`, `fix18`, `fix19`, `fix20`, `fix21`, `fix22`, `fix23`, `fix24`, `fix25`, `fix26`, `fix27`, `fix28`, `fix29`, `fix30`)
|
||||
VALUES (9, 99, 999, 9999, 99999, 999999, 9999999, 99999999, 999999999,
|
||||
9999999999, 99999999999, 999999999999, 9999999999999, 99999999999999,
|
||||
999999999999999, 9999999999999999, 99999999999999999, 999999999999999999,
|
||||
9999999999999999999, 99999999999999999999, 999999999999999999999,
|
||||
9999999999999999999999, 99999999999999999999999, 999999999999999999999999,
|
||||
9999999999999999999999999, 99999999999999999999999999,
|
||||
999999999999999999999999999, 9999999999999999999999999999,
|
||||
99999999999999999999999999999, 999999999999999999999999999999,
|
||||
9999999999999999999999999999999, 99999999999999999999999999999999,
|
||||
999999999999999999999999999999999, 9999999999999999999999999999999999,
|
||||
99999999999999999999999999999999999, 999999999999999999999999999999999999,
|
||||
9999999999999999999999999999999999999, 99999999999999999999999999999999999999,
|
||||
9999999999999999999999999999999999999.9,
|
||||
999999999999999999999999999999999999.99,
|
||||
99999999999999999999999999999999999.999,
|
||||
9999999999999999999999999999999999.9999,
|
||||
999999999999999999999999999999999.99999,
|
||||
99999999999999999999999999999999.999999,
|
||||
9999999999999999999999999999999.9999999,
|
||||
999999999999999999999999999999.99999999,
|
||||
99999999999999999999999999999.999999999,
|
||||
9999999999999999999999999999.9999999999,
|
||||
999999999999999999999999999.99999999999,
|
||||
99999999999999999999999999.999999999999,
|
||||
9999999999999999999999999.9999999999999,
|
||||
999999999999999999999999.99999999999999,
|
||||
99999999999999999999999.999999999999999,
|
||||
9999999999999999999999.9999999999999999,
|
||||
999999999999999999999.99999999999999999,
|
||||
99999999999999999999.999999999999999999,
|
||||
9999999999999999999.9999999999999999999,
|
||||
999999999999999999.99999999999999999999,
|
||||
99999999999999999.999999999999999999999,
|
||||
9999999999999999.9999999999999999999999,
|
||||
999999999999999.99999999999999999999999,
|
||||
99999999999999.999999999999999999999999,
|
||||
9999999999999.9999999999999999999999999,
|
||||
999999999999.99999999999999999999999999,
|
||||
99999999999.999999999999999999999999999,
|
||||
9999999999.9999999999999999999999999999,
|
||||
999999999.99999999999999999999999999999,
|
||||
99999999.999999999999999999999999999999);
|
||||
SELECT * FROM t1;
|
||||
col1 col2 col3 col4 col5 col6 col7 col8 col9 col10 col11 col12 col13 col14 col15 col16 col17 col18 col19 col20 col21 col22 col23 col24 col25 col26 col27 col28 col29 col30 col31 col32 col33 col34 col35 col36 col37 col38 fix1 fix2 fix3 fix4 fix5 fix6 fix7 fix8 fix9 fix10 fix11 fix12 fix13 fix14 fix15 fix16 fix17 fix18 fix19 fix20 fix21 fix22 fix23 fix24 fix25 fix26 fix27 fix28 fix29 fix30
|
||||
9 99 999 9999 99999 999999 9999999 99999999 999999999 9999999999 99999999999 999999999999 9999999999999 99999999999999 999999999999999 9999999999999999 99999999999999999 999999999999999999 9999999999999999999 99999999999999999999 999999999999999999999 9999999999999999999999 99999999999999999999999 999999999999999999999999 9999999999999999999999999 99999999999999999999999999 999999999999999999999999999 9999999999999999999999999999 99999999999999999999999999999 999999999999999999999999999999 9999999999999999999999999999999 99999999999999999999999999999999 999999999999999999999999999999999 9999999999999999999999999999999999 99999999999999999999999999999999999 999999999999999999999999999999999999 9999999999999999999999999999999999999 99999999999999999999999999999999999999 9999999999999999999999999999999999999.9 999999999999999999999999999999999999.99 99999999999999999999999999999999999.999 9999999999999999999999999999999999.9999 999999999999999999999999999999999.99999 99999999999999999999999999999999.999999 9999999999999999999999999999999.9999999 999999999999999999999999999999.99999999 99999999999999999999999999999.999999999 9999999999999999999999999999.9999999999 999999999999999999999999999.99999999999 99999999999999999999999999.999999999999 9999999999999999999999999.9999999999999 999999999999999999999999.99999999999999 99999999999999999999999.999999999999999 9999999999999999999999.9999999999999999 999999999999999999999.99999999999999999 99999999999999999999.999999999999999999 9999999999999999999.9999999999999999999 999999999999999999.99999999999999999999 99999999999999999.999999999999999999999 9999999999999999.9999999999999999999999 999999999999999.99999999999999999999999 99999999999999.999999999999999999999999 9999999999999.9999999999999999999999999 999999999999.99999999999999999999999999 99999999999.999999999999999999999999999 9999999999.9999999999999999999999999999 999999999.99999999999999999999999999999 99999999.999999999999999999999999999999
|
||||
DROP TABLE t1;
|
||||
create table t1 (bigint_col bigint unsigned);
|
||||
insert into t1 values (17666000000000000000);
|
||||
select * from t1 where bigint_col=17666000000000000000;
|
||||
bigint_col
|
||||
17666000000000000000
|
||||
select * from t1 where bigint_col='17666000000000000000';
|
||||
bigint_col
|
||||
17666000000000000000
|
||||
drop table t1;
|
||||
|
||||
bug 19955 -- mod is signed with bigint
|
||||
select cast(10000002383263201056 as unsigned) mod 50 as result;
|
||||
result
|
||||
6
|
||||
create table t1 (c1 bigint unsigned);
|
||||
insert into t1 values (10000002383263201056);
|
||||
select c1 mod 50 as result from t1;
|
||||
result
|
||||
6
|
||||
drop table t1;
|
||||
select cast(19999999999999999999 as signed);
|
||||
cast(19999999999999999999 as signed)
|
||||
9223372036854775807
|
||||
Warnings:
|
||||
Error 1292 Truncated incorrect DECIMAL value: ''
|
||||
select cast(-19999999999999999999 as signed);
|
||||
cast(-19999999999999999999 as signed)
|
||||
-9223372036854775808
|
||||
Warnings:
|
||||
Error 1292 Truncated incorrect DECIMAL value: ''
|
||||
select -9223372036854775808;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def -9223372036854775808 8 20 20 N 32897 0 63
|
||||
-9223372036854775808
|
||||
-9223372036854775808
|
||||
select -(9223372036854775808);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def -(9223372036854775808) 8 20 20 N 32897 0 63
|
||||
-(9223372036854775808)
|
||||
-9223372036854775808
|
||||
select -((9223372036854775808));
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def -((9223372036854775808)) 8 20 20 N 32897 0 63
|
||||
-((9223372036854775808))
|
||||
-9223372036854775808
|
||||
select -(-(9223372036854775808));
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def -(-(9223372036854775808)) 246 21 19 N 129 0 63
|
||||
-(-(9223372036854775808))
|
||||
9223372036854775808
|
||||
select --9223372036854775808, ---9223372036854775808, ----9223372036854775808;
|
||||
--9223372036854775808 ---9223372036854775808 ----9223372036854775808
|
||||
9223372036854775808 -9223372036854775808 9223372036854775808
|
||||
select -(-9223372036854775808), -(-(-9223372036854775808));
|
||||
-(-9223372036854775808) -(-(-9223372036854775808))
|
||||
9223372036854775808 -9223372036854775808
|
||||
create table t1 select -9223372036854775808 bi;
|
||||
describe t1;
|
||||
Field Type Null Key Default Extra
|
||||
bi bigint(20) NO 0
|
||||
drop table t1;
|
||||
create table t1 select -9223372036854775809 bi;
|
||||
describe t1;
|
||||
Field Type Null Key Default Extra
|
||||
bi decimal(19,0) NO 0
|
||||
drop table t1;
|
||||
#
|
||||
# Bug #45360: wrong results
|
||||
#
|
||||
CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
a BIGINT(20) UNSIGNED,
|
||||
b VARCHAR(20));
|
||||
INSERT INTO t1 (a) VALUES
|
||||
(0),
|
||||
(CAST(0x7FFFFFFFFFFFFFFF AS UNSIGNED)),
|
||||
(CAST(0x8000000000000000 AS UNSIGNED)),
|
||||
(CAST(0xFFFFFFFFFFFFFFFF AS UNSIGNED));
|
||||
UPDATE t1 SET b = a;
|
||||
# FFFFFFFFFFFFFFFF
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a = 18446744073709551615 AND TRIM(a) = b;
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where ((`test`.`t1`.`a` = 18446744073709551615) and ('18446744073709551615' = `test`.`t1`.`b`))
|
||||
# 8000000000000000
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a = 9223372036854775808 AND TRIM(a) = b;
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where ((`test`.`t1`.`a` = 9223372036854775808) and ('9223372036854775808' = `test`.`t1`.`b`))
|
||||
# 7FFFFFFFFFFFFFFF
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a = 9223372036854775807 AND TRIM(a) = b;
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where ((`test`.`t1`.`a` = 9223372036854775807) and ('9223372036854775807' = `test`.`t1`.`b`))
|
||||
# 0
|
||||
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a = 0 AND TRIM(a) = b;
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
Note 1003 select 1 AS `1` from `test`.`t1` where ((`test`.`t1`.`a` = 0) and ('0' = `test`.`t1`.`b`))
|
||||
DROP TABLE t1;
|
||||
# End of 5.1 tests
|
||||
200
build/lib/mysql/mysql-test/r/binary.result
Normal file
200
build/lib/mysql/mysql-test/r/binary.result
Normal file
@@ -0,0 +1,200 @@
|
||||
drop table if exists t1,t2;
|
||||
create table t1 (name char(20) not null, primary key (name));
|
||||
create table t2 (name char(20) binary not null, primary key (name));
|
||||
insert into t1 values ("å");
|
||||
insert into t1 values ("ä");
|
||||
insert into t1 values ("ö");
|
||||
insert into t2 select * from t1;
|
||||
select * from t1 order by name;
|
||||
name
|
||||
å
|
||||
ä
|
||||
ö
|
||||
select concat("*",name,"*") from t1 order by 1;
|
||||
concat("*",name,"*")
|
||||
*å*
|
||||
*ä*
|
||||
*ö*
|
||||
select min(name),min(concat("*",name,"*")),max(name),max(concat("*",name,"*")) from t1;
|
||||
min(name) min(concat("*",name,"*")) max(name) max(concat("*",name,"*"))
|
||||
å *å* ö *ö*
|
||||
select * from t2 order by name;
|
||||
name
|
||||
ä
|
||||
å
|
||||
ö
|
||||
select concat("*",name,"*") from t2 order by 1;
|
||||
concat("*",name,"*")
|
||||
*ä*
|
||||
*å*
|
||||
*ö*
|
||||
select min(name),min(concat("*",name,"*")),max(name),max(concat("*",name,"*")) from t2;
|
||||
min(name) min(concat("*",name,"*")) max(name) max(concat("*",name,"*"))
|
||||
ä *ä* ö *ö*
|
||||
select name from t1 where name between 'Ä' and 'Ö';
|
||||
name
|
||||
ä
|
||||
ö
|
||||
select name from t2 where name between 'ä' and 'ö';
|
||||
name
|
||||
ä
|
||||
å
|
||||
ö
|
||||
select name from t2 where name between 'Ä' and 'Ö';
|
||||
name
|
||||
drop table t1,t2;
|
||||
create table t1 (a char(10) not null, b char(10) binary not null,key (a), key(b));
|
||||
insert into t1 values ("hello ","hello "),("hello2 ","hello2 ");
|
||||
select concat("-",a,"-",b,"-") from t1 where a="hello";
|
||||
concat("-",a,"-",b,"-")
|
||||
-hello-hello-
|
||||
select concat("-",a,"-",b,"-") from t1 where a="hello ";
|
||||
concat("-",a,"-",b,"-")
|
||||
-hello-hello-
|
||||
select concat("-",a,"-",b,"-") from t1 ignore index (a) where a="hello ";
|
||||
concat("-",a,"-",b,"-")
|
||||
-hello-hello-
|
||||
select concat("-",a,"-",b,"-") from t1 where b="hello";
|
||||
concat("-",a,"-",b,"-")
|
||||
-hello-hello-
|
||||
select concat("-",a,"-",b,"-") from t1 where b="hello ";
|
||||
concat("-",a,"-",b,"-")
|
||||
-hello-hello-
|
||||
select concat("-",a,"-",b,"-") from t1 ignore index (b) where b="hello ";
|
||||
concat("-",a,"-",b,"-")
|
||||
-hello-hello-
|
||||
alter table t1 modify b tinytext not null, drop key b, add key (b(100));
|
||||
select concat("-",a,"-",b,"-") from t1;
|
||||
concat("-",a,"-",b,"-")
|
||||
-hello-hello-
|
||||
-hello2-hello2-
|
||||
select concat("-",a,"-",b,"-") from t1 where b="hello ";
|
||||
concat("-",a,"-",b,"-")
|
||||
-hello-hello-
|
||||
select concat("-",a,"-",b,"-") from t1 ignore index (b) where b="hello ";
|
||||
concat("-",a,"-",b,"-")
|
||||
-hello-hello-
|
||||
drop table t1;
|
||||
create table t1 (b char(8));
|
||||
insert into t1 values(NULL);
|
||||
select b from t1 where binary b like '';
|
||||
b
|
||||
select b from t1 group by binary b like '';
|
||||
b
|
||||
NULL
|
||||
select b from t1 having binary b like '';
|
||||
b
|
||||
drop table t1;
|
||||
create table t1 (a char(3) binary, b binary(3));
|
||||
insert into t1 values ('aaa','bbb'),('AAA','BBB');
|
||||
select upper(a),upper(b) from t1;
|
||||
upper(a) upper(b)
|
||||
AAA bbb
|
||||
AAA BBB
|
||||
select lower(a),lower(b) from t1;
|
||||
lower(a) lower(b)
|
||||
aaa bbb
|
||||
aaa BBB
|
||||
select * from t1 where upper(a)='AAA';
|
||||
a b
|
||||
aaa bbb
|
||||
AAA BBB
|
||||
select * from t1 where lower(a)='aaa';
|
||||
a b
|
||||
aaa bbb
|
||||
AAA BBB
|
||||
select * from t1 where upper(b)='BBB';
|
||||
a b
|
||||
AAA BBB
|
||||
select * from t1 where lower(b)='bbb';
|
||||
a b
|
||||
aaa bbb
|
||||
select charset(a), charset(b), charset(binary 'ccc') from t1 limit 1;
|
||||
charset(a) charset(b) charset(binary 'ccc')
|
||||
latin1 binary binary
|
||||
select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1;
|
||||
collation(a) collation(b) collation(binary 'ccc')
|
||||
latin1_bin binary binary
|
||||
drop table t1;
|
||||
create table t1( firstname char(20), lastname char(20));
|
||||
insert into t1 values ("john","doe"),("John","Doe");
|
||||
select * from t1 where firstname='john' and firstname like binary 'john';
|
||||
firstname lastname
|
||||
john doe
|
||||
select * from t1 where firstname='john' and binary 'john' = firstname;
|
||||
firstname lastname
|
||||
john doe
|
||||
select * from t1 where firstname='john' and firstname = binary 'john';
|
||||
firstname lastname
|
||||
john doe
|
||||
select * from t1 where firstname='John' and firstname like binary 'john';
|
||||
firstname lastname
|
||||
john doe
|
||||
select * from t1 where firstname='john' and firstname like binary 'John';
|
||||
firstname lastname
|
||||
John Doe
|
||||
drop table t1;
|
||||
create table t1 (a binary);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` binary(1) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 (col1 binary(4));
|
||||
insert into t1 values ('a'),('a ');
|
||||
select hex(col1) from t1;
|
||||
hex(col1)
|
||||
61000000
|
||||
61200000
|
||||
alter table t1 modify col1 binary(10);
|
||||
select hex(col1) from t1;
|
||||
hex(col1)
|
||||
61000000000000000000
|
||||
61200000000000000000
|
||||
insert into t1 values ('b'),('b ');
|
||||
select hex(col1) from t1;
|
||||
hex(col1)
|
||||
61000000000000000000
|
||||
61200000000000000000
|
||||
62000000000000000000
|
||||
62200000000000000000
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
a binary(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
|
||||
index idx(a)
|
||||
);
|
||||
INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029087575');
|
||||
INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020');
|
||||
INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029080707');
|
||||
SELECT hex(a) FROM t1 order by a;
|
||||
hex(a)
|
||||
1F9480179366F2BF567E1C4B964C1EF029080707
|
||||
1F9480179366F2BF567E1C4B964C1EF029082020
|
||||
1F9480179366F2BF567E1C4B964C1EF029087575
|
||||
EXPLAIN SELECT hex(a) FROM t1 order by a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index NULL idx 20 NULL 3 Using index
|
||||
SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020');
|
||||
hex(a)
|
||||
1F9480179366F2BF567E1C4B964C1EF029082020
|
||||
EXPLAIN
|
||||
SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020');
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref idx idx 20 const 1 Using where; Using index
|
||||
SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF02908');
|
||||
hex(a)
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
id numeric(20) NOT NULL,
|
||||
lang varchar(8) NOT NULL,
|
||||
msg varchar(32) NOT NULL,
|
||||
PRIMARY KEY (id,lang)
|
||||
);
|
||||
INSERT INTO t1 VALUES (33, 'en', 'zzzzzzz');
|
||||
INSERT INTO t1 VALUES (31, 'en', 'xxxxxxx');
|
||||
INSERT INTO t1 VALUES (32, 'en', 'yyyyyyy');
|
||||
SELECT * FROM t1 WHERE id=32;
|
||||
id lang msg
|
||||
32 en yyyyyyy
|
||||
DROP TABLE t1;
|
||||
48
build/lib/mysql/mysql-test/r/binlog_tx_isolation.result
Normal file
48
build/lib/mysql/mysql-test/r/binlog_tx_isolation.result
Normal file
@@ -0,0 +1,48 @@
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=INNODB;
|
||||
INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5),(6,6);
|
||||
SET BINLOG_FORMAT=STATEMENT;
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
ERROR HY000: Transaction isolation level 'READ-COMMITTED' is not safe for 'STATEMENT' binlog mode
|
||||
UPDATE t1 SET b = a*a WHERE a > 1;
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
UPDATE t1 SET b = a*a WHERE a > 1;
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
||||
UPDATE t1 SET b = a*a WHERE a > 1;
|
||||
COMMIT;
|
||||
SET BINLOG_FORMAT=MIXED;
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
ERROR HY000: Transaction isolation level 'READ-COMMITTED' is not safe for 'MIXED' binlog mode
|
||||
UPDATE t1 SET b = a*a*a WHERE a > 2;
|
||||
COMMIT;
|
||||
SET BINLOG_FORMAT=ROW;
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
UPDATE t1 SET b = a*a*a*a WHERE a > 3;
|
||||
COMMIT;
|
||||
SELECT @@session.tx_isolation, @@session.binlog_format;
|
||||
@@session.tx_isolation READ-COMMITTED
|
||||
@@session.binlog_format ROW
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
SET BINLOG_FORMAT=MIXED;
|
||||
ERROR HY000: Transaction isolation level 'READ-COMMITTED' prevents leaving 'ROW' binlog mode
|
||||
UPDATE t1 SET b = a*a*a*a WHERE a > 3;
|
||||
COMMIT;
|
||||
SELECT @@session.tx_isolation, @@session.binlog_format;
|
||||
@@session.tx_isolation READ-COMMITTED
|
||||
@@session.binlog_format ROW
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
SET BINLOG_FORMAT=STATEMENT;
|
||||
ERROR HY000: Transaction isolation level 'READ-COMMITTED' prevents leaving 'ROW' binlog mode
|
||||
UPDATE t1 SET b = a*a*a*a WHERE a > 3;
|
||||
COMMIT;
|
||||
SELECT @@session.tx_isolation, @@session.binlog_format;
|
||||
@@session.tx_isolation READ-COMMITTED
|
||||
@@session.binlog_format ROW
|
||||
88
build/lib/mysql/mysql-test/r/bool.result
Normal file
88
build/lib/mysql/mysql-test/r/bool.result
Normal file
@@ -0,0 +1,88 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
SELECT IF(NULL AND 1, 1, 2), IF(1 AND NULL, 1, 2);
|
||||
IF(NULL AND 1, 1, 2) IF(1 AND NULL, 1, 2)
|
||||
2 2
|
||||
SELECT NULL AND 1, 1 AND NULL, 0 AND NULL, NULL and 0;
|
||||
NULL AND 1 1 AND NULL 0 AND NULL NULL and 0
|
||||
NULL NULL 0 0
|
||||
create table t1 (a int);
|
||||
insert into t1 values (0),(1),(NULL);
|
||||
SELECT * FROM t1 WHERE IF(a AND 1, 0, 1);
|
||||
a
|
||||
0
|
||||
NULL
|
||||
SELECT * FROM t1 WHERE IF(1 AND a, 0, 1);
|
||||
a
|
||||
0
|
||||
NULL
|
||||
SELECT * FROM t1 where NOT(a AND 1);
|
||||
a
|
||||
0
|
||||
SELECT * FROM t1 where NOT(1 AND a);
|
||||
a
|
||||
0
|
||||
SELECT * FROM t1 where (a AND 1)=0;
|
||||
a
|
||||
0
|
||||
SELECT * FROM t1 where (1 AND a)=0;
|
||||
a
|
||||
0
|
||||
SELECT * FROM t1 where (1 AND a)=1;
|
||||
a
|
||||
1
|
||||
SELECT * FROM t1 where (1 AND a) IS NULL;
|
||||
a
|
||||
NULL
|
||||
set sql_mode='high_not_precedence';
|
||||
select * from t1 where not a between 2 and 3;
|
||||
a
|
||||
set sql_mode=default;
|
||||
select * from t1 where not a between 2 and 3;
|
||||
a
|
||||
0
|
||||
1
|
||||
select a, a is false, a is true, a is unknown from t1;
|
||||
a a is false a is true a is unknown
|
||||
0 1 0 0
|
||||
1 0 1 0
|
||||
NULL 0 0 1
|
||||
select a, a is not false, a is not true, a is not unknown from t1;
|
||||
a a is not false a is not true a is not unknown
|
||||
0 0 1 1
|
||||
1 1 0 1
|
||||
NULL 1 1 0
|
||||
SET @a=0, @b=0;
|
||||
SELECT * FROM t1 WHERE NULL AND (@a:=@a+1);
|
||||
a
|
||||
SELECT * FROM t1 WHERE NOT(a>=0 AND NULL AND (@b:=@b+1));
|
||||
a
|
||||
SELECT * FROM t1 WHERE a=2 OR (NULL AND (@a:=@a+1));
|
||||
a
|
||||
SELECT * FROM t1 WHERE NOT(a=2 OR (NULL AND (@b:=@b+1)));
|
||||
a
|
||||
DROP TABLE t1;
|
||||
create table t1 (a int, b int);
|
||||
insert into t1 values(null, null), (0, null), (1, null), (null, 0), (null, 1), (0, 0), (0, 1), (1, 0), (1, 1);
|
||||
select ifnull(A, 'N') as A, ifnull(B, 'N') as B, ifnull(not A, 'N') as nA, ifnull(not B, 'N') as nB, ifnull(A and B, 'N') as AB, ifnull(not (A and B), 'N') as `n(AB)`, ifnull((not A or not B), 'N') as nAonB, ifnull(A or B, 'N') as AoB, ifnull(not(A or B), 'N') as `n(AoB)`, ifnull(not A and not B, 'N') as nAnB from t1;
|
||||
A B nA nB AB n(AB) nAonB AoB n(AoB) nAnB
|
||||
N N N N N N N N N N
|
||||
0 N 1 N 0 1 1 N N N
|
||||
1 N 0 N N N N 1 0 0
|
||||
N 0 N 1 0 1 1 N N N
|
||||
N 1 N 0 N N N 1 0 0
|
||||
0 0 1 1 0 1 1 0 1 1
|
||||
0 1 1 0 0 1 1 1 0 0
|
||||
1 0 0 1 0 1 1 1 0 0
|
||||
1 1 0 0 1 0 0 1 0 0
|
||||
select ifnull(A=1, 'N') as A, ifnull(B=1, 'N') as B, ifnull(not (A=1), 'N') as nA, ifnull(not (B=1), 'N') as nB, ifnull((A=1) and (B=1), 'N') as AB, ifnull(not ((A=1) and (B=1)), 'N') as `n(AB)`, ifnull((not (A=1) or not (B=1)), 'N') as nAonB, ifnull((A=1) or (B=1), 'N') as AoB, ifnull(not((A=1) or (B=1)), 'N') as `n(AoB)`, ifnull(not (A=1) and not (B=1), 'N') as nAnB from t1;
|
||||
A B nA nB AB n(AB) nAonB AoB n(AoB) nAnB
|
||||
N N N N N N N N N N
|
||||
0 N 1 N 0 1 1 N N N
|
||||
1 N 0 N N N N 1 0 0
|
||||
N 0 N 1 0 1 1 N N N
|
||||
N 1 N 0 N N N 1 0 0
|
||||
0 0 1 1 0 1 1 0 1 1
|
||||
0 1 1 0 0 1 1 1 0 0
|
||||
1 0 0 1 0 1 1 1 0 0
|
||||
1 1 0 0 1 0 0 1 0 0
|
||||
drop table t1;
|
||||
8
build/lib/mysql/mysql-test/r/bootstrap.result
Normal file
8
build/lib/mysql/mysql-test/r/bootstrap.result
Normal file
@@ -0,0 +1,8 @@
|
||||
drop table if exists t1;
|
||||
drop table t1;
|
||||
drop table t1;
|
||||
ERROR 42S02: Unknown table 't1'
|
||||
set @my_max_allowed_packet= @@max_allowed_packet;
|
||||
set global max_allowed_packet=100*@@max_allowed_packet;
|
||||
set global max_allowed_packet=@my_max_allowed_packet;
|
||||
drop table t1;
|
||||
32
build/lib/mysql/mysql-test/r/bug39022.result
Normal file
32
build/lib/mysql/mysql-test/r/bug39022.result
Normal file
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# Bug #39022: Mysql randomly crashing in lock_sec_rec_cons_read_sees
|
||||
#
|
||||
CREATE TABLE t1(a TINYINT NOT NULL,b TINYINT,PRIMARY KEY(b)) ENGINE=innodb;
|
||||
CREATE TABLE t2(d TINYINT NOT NULL,UNIQUE KEY(d)) ENGINE=innodb;
|
||||
INSERT INTO t1 VALUES (13,0),(8,1),(9,2),(6,3),
|
||||
(11,5),(11,6),(7,7),(7,8),(4,9),(6,10),(3,11),(11,12),
|
||||
(12,13),(7,14);
|
||||
INSERT INTO t2 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),
|
||||
(11),(12),(13),(14);
|
||||
# in thread1
|
||||
START TRANSACTION;
|
||||
# in thread2
|
||||
REPLACE INTO t2 VALUES (-17);
|
||||
SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE;
|
||||
d
|
||||
# in thread1
|
||||
REPLACE INTO t1(a,b) VALUES (67,20);
|
||||
# in thread2
|
||||
COMMIT;
|
||||
START TRANSACTION;
|
||||
REPLACE INTO t1(a,b) VALUES (65,-50);
|
||||
REPLACE INTO t2 VALUES (-91);
|
||||
SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE;
|
||||
# in thread1
|
||||
# should not crash
|
||||
SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE;
|
||||
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
|
||||
# in thread2
|
||||
d
|
||||
# in thread1;
|
||||
DROP TABLE t1,t2;
|
||||
16
build/lib/mysql/mysql-test/r/bug46080.result
Normal file
16
build/lib/mysql/mysql-test/r/bug46080.result
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# Bug #46080: group_concat(... order by) crashes server when
|
||||
# sort_buffer_size cannot allocate
|
||||
#
|
||||
call mtr.add_suppression("Out of memory at line .*, '.*my_alloc.c'");
|
||||
call mtr.add_suppression("needed .* byte (.*k)., memory in use: .* bytes (.*k)");
|
||||
CREATE TABLE t1(a CHAR(255));
|
||||
INSERT INTO t1 VALUES ('a');
|
||||
SET @@SESSION.sort_buffer_size=5*16*1000000;
|
||||
SET @@SESSION.max_heap_table_size=5*1000000;
|
||||
# Must not crash.
|
||||
SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a;
|
||||
DROP TABLE t1;
|
||||
SET @@SESSION.sort_buffer_size=default;
|
||||
SET @@SESSION.max_heap_table_size=default;
|
||||
End of 5.0 tests
|
||||
8
build/lib/mysql/mysql-test/r/bug46261.result
Normal file
8
build/lib/mysql/mysql-test/r/bug46261.result
Normal file
@@ -0,0 +1,8 @@
|
||||
#
|
||||
# Bug#46261 Plugins can be installed with --skip-grant-tables
|
||||
#
|
||||
INSTALL PLUGIN example SONAME 'ha_example.so';
|
||||
ERROR HY000: The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
|
||||
UNINSTALL PLUGIN example;
|
||||
ERROR HY000: The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
|
||||
End of 5.1 tests
|
||||
43
build/lib/mysql/mysql-test/r/bug46760.result
Normal file
43
build/lib/mysql/mysql-test/r/bug46760.result
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# Bug#46760: Fast ALTER TABLE no longer works for InnoDB
|
||||
#
|
||||
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
# By using --enable_info and verifying that number of affected
|
||||
# rows is 0 we check that this ALTER TABLE is really carried
|
||||
# out as "fast/online" operation, i.e. without full-blown data
|
||||
# copying.
|
||||
#
|
||||
# I.e. info for the below statement should normally look like:
|
||||
#
|
||||
# affected rows: 0
|
||||
# info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
ALTER TABLE t1 ALTER COLUMN a SET DEFAULT 10;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT '10'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MySQL Bug#39200: optimize table does not recognize
|
||||
# ROW_FORMAT=COMPRESSED
|
||||
#
|
||||
CREATE TABLE t1 (a INT) ROW_FORMAT=compressed;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
|
||||
OPTIMIZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize status Table is already up to date
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
13
build/lib/mysql/mysql-test/r/bug47671.result
Normal file
13
build/lib/mysql/mysql-test/r/bug47671.result
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
# Bug#47671 - wrong character-set after upgrade from 5.1.34 to 5.1.39
|
||||
#
|
||||
# Extract only charset information from 'status' command output using regex
|
||||
--------------
|
||||
|
||||
Server characterset: utf8
|
||||
Db characterset: utf8
|
||||
Client characterset: utf8
|
||||
Conn. characterset: utf8
|
||||
|
||||
--------------
|
||||
|
||||
11
build/lib/mysql/mysql-test/r/bulk_replace.result
Normal file
11
build/lib/mysql/mysql-test/r/bulk_replace.result
Normal file
@@ -0,0 +1,11 @@
|
||||
drop table if exists t1;
|
||||
CREATE TABLE t1 (a int, unique (a), b int not null, unique(b), c int not null, index(c));
|
||||
replace into t1 values (1,1,1),(2,2,2),(3,1,3);
|
||||
select * from t1;
|
||||
a b c
|
||||
3 1 3
|
||||
2 2 2
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
drop table t1;
|
||||
223
build/lib/mysql/mysql-test/r/cache_innodb.result
Normal file
223
build/lib/mysql/mysql-test/r/cache_innodb.result
Normal file
@@ -0,0 +1,223 @@
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
drop table if exists t1,t2,t3;
|
||||
set @save_query_cache_size = @@global.query_cache_size;
|
||||
set GLOBAL query_cache_size = 1355776;
|
||||
flush status;
|
||||
set autocommit=0;
|
||||
create table t1 (a int not null);
|
||||
insert into t1 values (1),(2),(3);
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 0
|
||||
drop table t1;
|
||||
commit;
|
||||
set autocommit=1;
|
||||
begin;
|
||||
create table t1 (a int not null);
|
||||
insert into t1 values (1),(2),(3);
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
drop table t1;
|
||||
commit;
|
||||
create table t1 (a int not null);
|
||||
create table t2 (a int not null);
|
||||
create table t3 (a int not null);
|
||||
insert into t1 values (1),(2);
|
||||
insert into t2 values (1),(2);
|
||||
insert into t3 values (1),(2);
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
select * from t2;
|
||||
a
|
||||
1
|
||||
2
|
||||
select * from t3;
|
||||
a
|
||||
1
|
||||
2
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 3
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
begin;
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
select * from t2;
|
||||
a
|
||||
1
|
||||
2
|
||||
select * from t3;
|
||||
a
|
||||
1
|
||||
2
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 6
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
insert into t1 values (3);
|
||||
insert into t2 values (3);
|
||||
insert into t1 values (4);
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
select * from t2;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
select * from t3;
|
||||
a
|
||||
1
|
||||
2
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 2
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 1
|
||||
commit;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 2
|
||||
drop table t3,t2,t1;
|
||||
CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id));
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
insert into t1 (id) values (0);
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( id int(10) NOT NULL auto_increment, a varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY a (a));
|
||||
CREATE TABLE t2 ( id int(10) NOT NULL auto_increment, b varchar(25) default NULL, PRIMARY KEY (id), UNIQUE KEY b (b));
|
||||
CREATE TABLE t3 ( id int(10) NOT NULL auto_increment, t1_id int(10) NOT NULL default '0', t2_id int(10) NOT NULL default '0', state int(11) default NULL, PRIMARY KEY (id), UNIQUE KEY t1_id (t1_id,t2_id), KEY t2_id (t2_id,t1_id), CONSTRAINT `t3_ibfk_1` FOREIGN KEY (`t1_id`) REFERENCES `t1` (`id`), CONSTRAINT `t3_ibfk_2` FOREIGN KEY (`t2_id`) REFERENCES `t2` (`id`));
|
||||
INSERT INTO t1 VALUES (1,'me');
|
||||
INSERT INTO t2 VALUES (1,'you');
|
||||
INSERT INTO t3 VALUES (2,1,1,2);
|
||||
delete from t3 where t1_id = 1 and t2_id = 1;
|
||||
select t1.* from t1, t2, t3 where t3.state & 1 = 0 and t3.t1_id = t1.id and t3.t2_id = t2.id and t1.id = 1 order by t1.a asc;
|
||||
id a
|
||||
begin;
|
||||
insert into t3 VALUES ( NULL, 1, 1, 2 );
|
||||
insert into t3 VALUES ( NULL, 1, 1, 2 );
|
||||
ERROR 23000: Duplicate entry '1-1' for key 't1_id'
|
||||
commit;
|
||||
select t1.* from t1, t2, t3 where t3.state & 1 = 0 and t3.t1_id = t1.id and t3.t2_id = t2.id and t1.id = 1 order by t1.a asc;
|
||||
id a
|
||||
1 me
|
||||
drop table t3,t2,t1;
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
SET @@autocommit=1;
|
||||
connection default
|
||||
SHOW VARIABLES LIKE 'have_query_cache';
|
||||
Variable_name Value
|
||||
have_query_cache YES
|
||||
SET GLOBAL query_cache_size = 200000;
|
||||
flush status;
|
||||
SET @@autocommit=1;
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
CREATE TABLE t2 (s1 int, s2 varchar(1000), key(s1));
|
||||
INSERT INTO t2 VALUES (1,repeat('a',10)),(2,repeat('a',10)),(3,repeat('a',10)),(4,repeat('a',10));
|
||||
COMMIT;
|
||||
START TRANSACTION;
|
||||
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
||||
count(*)
|
||||
0
|
||||
UPDATE t2 SET s2 = 'w' WHERE s1 = 3;
|
||||
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
||||
count(*)
|
||||
1
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 0
|
||||
connection connection1
|
||||
START TRANSACTION;
|
||||
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
||||
count(*)
|
||||
0
|
||||
INSERT INTO t2 VALUES (5,'w');
|
||||
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
||||
count(*)
|
||||
1
|
||||
COMMIT;
|
||||
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
||||
count(*)
|
||||
1
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 0
|
||||
connection default
|
||||
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
||||
count(*)
|
||||
1
|
||||
COMMIT;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 0
|
||||
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
||||
count(*)
|
||||
2
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
connection connection1
|
||||
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
||||
count(*)
|
||||
2
|
||||
START TRANSACTION;
|
||||
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
||||
count(*)
|
||||
2
|
||||
INSERT INTO t2 VALUES (6,'w');
|
||||
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
||||
count(*)
|
||||
3
|
||||
connection default
|
||||
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
||||
count(*)
|
||||
2
|
||||
START TRANSACTION;
|
||||
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
||||
count(*)
|
||||
2
|
||||
DELETE from t2 WHERE s1=3;
|
||||
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
||||
count(*)
|
||||
1
|
||||
COMMIT;
|
||||
connection connection1
|
||||
COMMIT;
|
||||
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
|
||||
count(*)
|
||||
2
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 1
|
||||
set @@global.query_cache_size = @save_query_cache_size;
|
||||
drop table t2;
|
||||
220
build/lib/mysql/mysql-test/r/case.result
Normal file
220
build/lib/mysql/mysql-test/r/case.result
Normal file
@@ -0,0 +1,220 @@
|
||||
drop table if exists t1, t2;
|
||||
select CASE "b" when "a" then 1 when "b" then 2 END;
|
||||
CASE "b" when "a" then 1 when "b" then 2 END
|
||||
2
|
||||
select CASE "c" when "a" then 1 when "b" then 2 END;
|
||||
CASE "c" when "a" then 1 when "b" then 2 END
|
||||
NULL
|
||||
select CASE "c" when "a" then 1 when "b" then 2 ELSE 3 END;
|
||||
CASE "c" when "a" then 1 when "b" then 2 ELSE 3 END
|
||||
3
|
||||
select CASE BINARY "b" when "a" then 1 when "B" then 2 WHEN "b" then "ok" END;
|
||||
CASE BINARY "b" when "a" then 1 when "B" then 2 WHEN "b" then "ok" END
|
||||
ok
|
||||
select CASE "b" when "a" then 1 when binary "B" then 2 WHEN "b" then "ok" END;
|
||||
CASE "b" when "a" then 1 when binary "B" then 2 WHEN "b" then "ok" END
|
||||
ok
|
||||
select CASE concat("a","b") when concat("ab","") then "a" when "b" then "b" end;
|
||||
CASE concat("a","b") when concat("ab","") then "a" when "b" then "b" end
|
||||
a
|
||||
select CASE when 1=0 then "true" else "false" END;
|
||||
CASE when 1=0 then "true" else "false" END
|
||||
false
|
||||
select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END;
|
||||
CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END
|
||||
one
|
||||
explain extended select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select (case 1 when 1 then 'one' when 2 then 'two' else 'more' end) AS `CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END`
|
||||
select CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END;
|
||||
CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END
|
||||
two
|
||||
select (CASE "two" when "one" then "1" WHEN "two" then "2" END) | 0;
|
||||
(CASE "two" when "one" then "1" WHEN "two" then "2" END) | 0
|
||||
2
|
||||
select (CASE "two" when "one" then 1.00 WHEN "two" then 2.00 END) +0.0;
|
||||
(CASE "two" when "one" then 1.00 WHEN "two" then 2.00 END) +0.0
|
||||
2.00
|
||||
select case 1/0 when "a" then "true" else "false" END;
|
||||
case 1/0 when "a" then "true" else "false" END
|
||||
false
|
||||
select case 1/0 when "a" then "true" END;
|
||||
case 1/0 when "a" then "true" END
|
||||
NULL
|
||||
select (case 1/0 when "a" then "true" END) | 0;
|
||||
(case 1/0 when "a" then "true" END) | 0
|
||||
NULL
|
||||
select (case 1/0 when "a" then "true" END) + 0.0;
|
||||
(case 1/0 when "a" then "true" END) + 0.0
|
||||
NULL
|
||||
select case when 1>0 then "TRUE" else "FALSE" END;
|
||||
case when 1>0 then "TRUE" else "FALSE" END
|
||||
TRUE
|
||||
select case when 1<0 then "TRUE" else "FALSE" END;
|
||||
case when 1<0 then "TRUE" else "FALSE" END
|
||||
FALSE
|
||||
create table t1 (a int);
|
||||
insert into t1 values(1),(2),(3),(4);
|
||||
select case a when 1 then 2 when 2 then 3 else 0 end as fcase, count(*) from t1 group by fcase;
|
||||
fcase count(*)
|
||||
0 2
|
||||
2 1
|
||||
3 1
|
||||
explain extended select case a when 1 then 2 when 2 then 3 else 0 end as fcase, count(*) from t1 group by fcase;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort
|
||||
Warnings:
|
||||
Note 1003 select (case `test`.`t1`.`a` when 1 then 2 when 2 then 3 else 0 end) AS `fcase`,count(0) AS `count(*)` from `test`.`t1` group by (case `test`.`t1`.`a` when 1 then 2 when 2 then 3 else 0 end)
|
||||
select case a when 1 then "one" when 2 then "two" else "nothing" end as fcase, count(*) from t1 group by fcase;
|
||||
fcase count(*)
|
||||
nothing 2
|
||||
one 1
|
||||
two 1
|
||||
drop table t1;
|
||||
create table t1 (row int not null, col int not null, val varchar(255) not null);
|
||||
insert into t1 values (1,1,'orange'),(1,2,'large'),(2,1,'yellow'),(2,2,'medium'),(3,1,'green'),(3,2,'small');
|
||||
select max(case col when 1 then val else null end) as color from t1 group by row;
|
||||
color
|
||||
orange
|
||||
yellow
|
||||
green
|
||||
drop table t1;
|
||||
SET NAMES latin1;
|
||||
CREATE TABLE t1 SELECT
|
||||
CASE WHEN 1 THEN _latin1'a' COLLATE latin1_danish_ci ELSE _latin1'a' END AS c1,
|
||||
CASE WHEN 1 THEN _latin1'a' ELSE _latin1'a' COLLATE latin1_danish_ci END AS c2,
|
||||
CASE WHEN 1 THEN 'a' ELSE 1 END AS c3,
|
||||
CASE WHEN 1 THEN 1 ELSE 'a' END AS c4,
|
||||
CASE WHEN 1 THEN 'a' ELSE 1.0 END AS c5,
|
||||
CASE WHEN 1 THEN 1.0 ELSE 'a' END AS c6,
|
||||
CASE WHEN 1 THEN 1 ELSE 1.0 END AS c7,
|
||||
CASE WHEN 1 THEN 1.0 ELSE 1 END AS c8,
|
||||
CASE WHEN 1 THEN 1.0 END AS c9,
|
||||
CASE WHEN 1 THEN 0.1e1 else 0.1 END AS c10,
|
||||
CASE WHEN 1 THEN 0.1e1 else 1 END AS c11,
|
||||
CASE WHEN 1 THEN 0.1e1 else '1' END AS c12
|
||||
;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varchar(1) CHARACTER SET latin1 COLLATE latin1_danish_ci NOT NULL DEFAULT '',
|
||||
`c2` varchar(1) CHARACTER SET latin1 COLLATE latin1_danish_ci NOT NULL DEFAULT '',
|
||||
`c3` varbinary(1) NOT NULL DEFAULT '',
|
||||
`c4` varbinary(1) NOT NULL DEFAULT '',
|
||||
`c5` varbinary(4) NOT NULL DEFAULT '',
|
||||
`c6` varbinary(4) NOT NULL DEFAULT '',
|
||||
`c7` decimal(2,1) NOT NULL DEFAULT '0.0',
|
||||
`c8` decimal(2,1) NOT NULL DEFAULT '0.0',
|
||||
`c9` decimal(2,1) DEFAULT NULL,
|
||||
`c10` double NOT NULL DEFAULT '0',
|
||||
`c11` double NOT NULL DEFAULT '0',
|
||||
`c12` varbinary(5) NOT NULL DEFAULT ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
SELECT CASE
|
||||
WHEN 1
|
||||
THEN _latin1'a' COLLATE latin1_danish_ci
|
||||
ELSE _latin1'a' COLLATE latin1_swedish_ci
|
||||
END;
|
||||
ERROR HY000: Illegal mix of collations (latin1_danish_ci,EXPLICIT) and (latin1_swedish_ci,EXPLICIT) for operation 'case'
|
||||
SELECT CASE _latin1'a' COLLATE latin1_general_ci
|
||||
WHEN _latin1'a' COLLATE latin1_danish_ci THEN 1
|
||||
WHEN _latin1'a' COLLATE latin1_swedish_ci THEN 2
|
||||
END;
|
||||
ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT), (latin1_danish_ci,EXPLICIT), (latin1_swedish_ci,EXPLICIT) for operation 'case'
|
||||
SELECT
|
||||
CASE _latin1'a' COLLATE latin1_general_ci WHEN _latin1'A' THEN '1' ELSE 2 END,
|
||||
CASE _latin1'a' COLLATE latin1_bin WHEN _latin1'A' THEN '1' ELSE 2 END,
|
||||
CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_swedish_ci THEN '1' ELSE 2 END,
|
||||
CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_bin THEN '1' ELSE 2 END
|
||||
;
|
||||
CASE _latin1'a' COLLATE latin1_general_ci WHEN _latin1'A' THEN '1' ELSE 2 END CASE _latin1'a' COLLATE latin1_bin WHEN _latin1'A' THEN '1' ELSE 2 END CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_swedish_ci THEN '1' ELSE 2 END CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_bin THEN '1' ELSE 2 END
|
||||
1 2 1 2
|
||||
CREATE TABLE t1 SELECT COALESCE(_latin1'a',_latin2'a');
|
||||
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'coalesce'
|
||||
CREATE TABLE t1 SELECT COALESCE('a' COLLATE latin1_swedish_ci,'b' COLLATE latin1_bin);
|
||||
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation 'coalesce'
|
||||
CREATE TABLE t1 SELECT
|
||||
COALESCE(1), COALESCE(1.0),COALESCE('a'),
|
||||
COALESCE(1,1.0), COALESCE(1,'1'),COALESCE(1.1,'1'),
|
||||
COALESCE('a' COLLATE latin1_bin,'b');
|
||||
explain extended SELECT
|
||||
COALESCE(1), COALESCE(1.0),COALESCE('a'),
|
||||
COALESCE(1,1.0), COALESCE(1,'1'),COALESCE(1.1,'1'),
|
||||
COALESCE('a' COLLATE latin1_bin,'b');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select coalesce(1) AS `COALESCE(1)`,coalesce(1.0) AS `COALESCE(1.0)`,coalesce('a') AS `COALESCE('a')`,coalesce(1,1.0) AS `COALESCE(1,1.0)`,coalesce(1,'1') AS `COALESCE(1,'1')`,coalesce(1.1,'1') AS `COALESCE(1.1,'1')`,coalesce(('a' collate latin1_bin),'b') AS `COALESCE('a' COLLATE latin1_bin,'b')`
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`COALESCE(1)` int(1) NOT NULL DEFAULT '0',
|
||||
`COALESCE(1.0)` decimal(2,1) NOT NULL DEFAULT '0.0',
|
||||
`COALESCE('a')` varchar(1) NOT NULL DEFAULT '',
|
||||
`COALESCE(1,1.0)` decimal(2,1) NOT NULL DEFAULT '0.0',
|
||||
`COALESCE(1,'1')` varbinary(1) NOT NULL DEFAULT '',
|
||||
`COALESCE(1.1,'1')` varbinary(4) NOT NULL DEFAULT '',
|
||||
`COALESCE('a' COLLATE latin1_bin,'b')` varchar(1) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
SELECT 'case+union+test'
|
||||
UNION
|
||||
SELECT CASE LOWER('1') WHEN LOWER('2') THEN 'BUG' ELSE 'nobug' END;
|
||||
case+union+test
|
||||
case+union+test
|
||||
nobug
|
||||
SELECT CASE LOWER('1') WHEN LOWER('2') THEN 'BUG' ELSE 'nobug' END;
|
||||
CASE LOWER('1') WHEN LOWER('2') THEN 'BUG' ELSE 'nobug' END
|
||||
nobug
|
||||
SELECT 'case+union+test'
|
||||
UNION
|
||||
SELECT CASE '1' WHEN '2' THEN 'BUG' ELSE 'nobug' END;
|
||||
case+union+test
|
||||
case+union+test
|
||||
nobug
|
||||
create table t1(a float, b int default 3);
|
||||
insert into t1 (a) values (2), (11), (8);
|
||||
select min(a), min(case when 1=1 then a else NULL end),
|
||||
min(case when 1!=1 then NULL else a end)
|
||||
from t1 where b=3 group by b;
|
||||
min(a) min(case when 1=1 then a else NULL end) min(case when 1!=1 then NULL else a end)
|
||||
2 2 2
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (EMPNUM INT);
|
||||
INSERT INTO t1 VALUES (0), (2);
|
||||
CREATE TABLE t2 (EMPNUM DECIMAL (4, 2));
|
||||
INSERT INTO t2 VALUES (0.0), (9.0);
|
||||
SELECT COALESCE(t2.EMPNUM,t1.EMPNUM) AS CEMPNUM,
|
||||
t1.EMPNUM AS EMPMUM1, t2.EMPNUM AS EMPNUM2
|
||||
FROM t1 LEFT JOIN t2 ON t1.EMPNUM=t2.EMPNUM;
|
||||
CEMPNUM EMPMUM1 EMPNUM2
|
||||
0.00 0 0.00
|
||||
2.00 2 NULL
|
||||
SELECT IFNULL(t2.EMPNUM,t1.EMPNUM) AS CEMPNUM,
|
||||
t1.EMPNUM AS EMPMUM1, t2.EMPNUM AS EMPNUM2
|
||||
FROM t1 LEFT JOIN t2 ON t1.EMPNUM=t2.EMPNUM;
|
||||
CEMPNUM EMPMUM1 EMPNUM2
|
||||
0.00 0 0.00
|
||||
2.00 2 NULL
|
||||
DROP TABLE t1,t2;
|
||||
End of 4.1 tests
|
||||
create table t1 (a int, b bigint unsigned);
|
||||
create table t2 (c int);
|
||||
insert into t1 (a, b) values (1,4572794622775114594), (2,18196094287899841997),
|
||||
(3,11120436154190595086);
|
||||
insert into t2 (c) values (1), (2), (3);
|
||||
select t1.a, (case t1.a when 0 then 0 else t1.b end) d from t1
|
||||
join t2 on t1.a=t2.c order by d;
|
||||
a d
|
||||
1 4572794622775114594
|
||||
3 11120436154190595086
|
||||
2 18196094287899841997
|
||||
select t1.a, (case t1.a when 0 then 0 else t1.b end) d from t1
|
||||
join t2 on t1.a=t2.c where b=11120436154190595086 order by d;
|
||||
a d
|
||||
3 11120436154190595086
|
||||
drop table t1, t2;
|
||||
End of 5.0 tests
|
||||
@@ -0,0 +1,2 @@
|
||||
Variable_name Value
|
||||
lower_case_file_system ON
|
||||
2
build/lib/mysql/mysql-test/r/case_insensitive_fs.require
Normal file
2
build/lib/mysql/mysql-test/r/case_insensitive_fs.require
Normal file
@@ -0,0 +1,2 @@
|
||||
Variable_name Value
|
||||
lower_case_file_system ON
|
||||
@@ -0,0 +1,2 @@
|
||||
Variable_name Value
|
||||
lower_case_file_system OFF
|
||||
498
build/lib/mysql/mysql-test/r/cast.result
Normal file
498
build/lib/mysql/mysql-test/r/cast.result
Normal file
@@ -0,0 +1,498 @@
|
||||
select CAST(1-2 AS UNSIGNED);
|
||||
CAST(1-2 AS UNSIGNED)
|
||||
18446744073709551615
|
||||
select CAST(CAST(1-2 AS UNSIGNED) AS SIGNED INTEGER);
|
||||
CAST(CAST(1-2 AS UNSIGNED) AS SIGNED INTEGER)
|
||||
-1
|
||||
select CAST('10 ' as unsigned integer);
|
||||
CAST('10 ' as unsigned integer)
|
||||
10
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '10 '
|
||||
select cast(-5 as unsigned) | 1, cast(-5 as unsigned) & -1;
|
||||
cast(-5 as unsigned) | 1 cast(-5 as unsigned) & -1
|
||||
18446744073709551611 18446744073709551611
|
||||
select cast(-5 as unsigned) -1, cast(-5 as unsigned) + 1;
|
||||
cast(-5 as unsigned) -1 cast(-5 as unsigned) + 1
|
||||
18446744073709551610 18446744073709551612
|
||||
select ~5, cast(~5 as signed);
|
||||
~5 cast(~5 as signed)
|
||||
18446744073709551610 -6
|
||||
explain extended select ~5, cast(~5 as signed);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select ~(5) AS `~5`,cast(~(5) as signed) AS `cast(~5 as signed)`
|
||||
select cast(5 as unsigned) -6.0;
|
||||
cast(5 as unsigned) -6.0
|
||||
-1.0
|
||||
select cast(NULL as signed), cast(1/0 as signed);
|
||||
cast(NULL as signed) cast(1/0 as signed)
|
||||
NULL NULL
|
||||
select cast(NULL as unsigned), cast(1/0 as unsigned);
|
||||
cast(NULL as unsigned) cast(1/0 as unsigned)
|
||||
NULL NULL
|
||||
select cast("A" as binary) = "a", cast(BINARY "a" as CHAR) = "A";
|
||||
cast("A" as binary) = "a" cast(BINARY "a" as CHAR) = "A"
|
||||
0 1
|
||||
select cast("2001-1-1" as DATE), cast("2001-1-1" as DATETIME);
|
||||
cast("2001-1-1" as DATE) cast("2001-1-1" as DATETIME)
|
||||
2001-01-01 2001-01-01 00:00:00
|
||||
select cast("1:2:3" as TIME);
|
||||
cast("1:2:3" as TIME)
|
||||
01:02:03
|
||||
select CONVERT("2004-01-22 21:45:33",DATE);
|
||||
CONVERT("2004-01-22 21:45:33",DATE)
|
||||
2004-01-22
|
||||
select 10+'10';
|
||||
10+'10'
|
||||
20
|
||||
select 10.0+'10';
|
||||
10.0+'10'
|
||||
20
|
||||
select 10E+0+'10';
|
||||
10E+0+'10'
|
||||
20
|
||||
select CONVERT(DATE "2004-01-22 21:45:33" USING latin1);
|
||||
CONVERT(DATE "2004-01-22 21:45:33" USING latin1)
|
||||
2004-01-22 21:45:33
|
||||
select CONVERT(DATE "2004-01-22 21:45:33",CHAR);
|
||||
CONVERT(DATE "2004-01-22 21:45:33",CHAR)
|
||||
2004-01-22 21:45:33
|
||||
select CONVERT(DATE "2004-01-22 21:45:33",CHAR(4));
|
||||
CONVERT(DATE "2004-01-22 21:45:33",CHAR(4))
|
||||
2004
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect CHAR(4) value: '2004-01-22 21:45:33'
|
||||
select CONVERT(DATE "2004-01-22 21:45:33",BINARY(4));
|
||||
CONVERT(DATE "2004-01-22 21:45:33",BINARY(4))
|
||||
2004
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect BINARY(4) value: '2004-01-22 21:45:33'
|
||||
select CAST(DATE "2004-01-22 21:45:33" AS BINARY(4));
|
||||
CAST(DATE "2004-01-22 21:45:33" AS BINARY(4))
|
||||
2004
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect BINARY(4) value: '2004-01-22 21:45:33'
|
||||
select CAST(0xb3 as signed);
|
||||
CAST(0xb3 as signed)
|
||||
179
|
||||
select CAST(0x8fffffffffffffff as signed);
|
||||
CAST(0x8fffffffffffffff as signed)
|
||||
-8070450532247928833
|
||||
select CAST(0xffffffffffffffff as unsigned);
|
||||
CAST(0xffffffffffffffff as unsigned)
|
||||
18446744073709551615
|
||||
select CAST(0xfffffffffffffffe as signed);
|
||||
CAST(0xfffffffffffffffe as signed)
|
||||
-2
|
||||
select cast('-10a' as signed integer);
|
||||
cast('-10a' as signed integer)
|
||||
-10
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-10a'
|
||||
select cast('a10' as unsigned integer);
|
||||
cast('a10' as unsigned integer)
|
||||
0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: 'a10'
|
||||
select 10+'a';
|
||||
10+'a'
|
||||
10
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'a'
|
||||
select 10.0+cast('a' as decimal);
|
||||
10.0+cast('a' as decimal)
|
||||
10.0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DECIMAL value: 'a'
|
||||
select 10E+0+'a';
|
||||
10E+0+'a'
|
||||
10
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'a'
|
||||
select cast('18446744073709551616' as unsigned);
|
||||
cast('18446744073709551616' as unsigned)
|
||||
18446744073709551615
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '18446744073709551616'
|
||||
select cast('18446744073709551616' as signed);
|
||||
cast('18446744073709551616' as signed)
|
||||
-1
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '18446744073709551616'
|
||||
select cast('9223372036854775809' as signed);
|
||||
cast('9223372036854775809' as signed)
|
||||
-9223372036854775807
|
||||
Warnings:
|
||||
Warning 1105 Cast to signed converted positive out-of-range integer to it's negative complement
|
||||
select cast('-1' as unsigned);
|
||||
cast('-1' as unsigned)
|
||||
18446744073709551615
|
||||
Warnings:
|
||||
Warning 1105 Cast to unsigned converted negative integer to it's positive complement
|
||||
select cast('abc' as signed);
|
||||
cast('abc' as signed)
|
||||
0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: 'abc'
|
||||
select cast('1a' as signed);
|
||||
cast('1a' as signed)
|
||||
1
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1a'
|
||||
select cast('' as signed);
|
||||
cast('' as signed)
|
||||
0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: ''
|
||||
set names binary;
|
||||
select cast(_latin1'test' as char character set latin2);
|
||||
cast(_latin1'test' as char character set latin2)
|
||||
test
|
||||
select cast(_koi8r'ÔÅÓÔ' as char character set cp1251);
|
||||
cast(_koi8r'ÔÅÓÔ' as char character set cp1251)
|
||||
òåñò
|
||||
create table t1 select cast(_koi8r'ÔÅÓÔ' as char character set cp1251) as t;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`t` varchar(4) CHARACTER SET cp1251 NOT NULL DEFAULT ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select
|
||||
cast(_latin1'ab' AS char) as c1,
|
||||
cast(_latin1'a ' AS char) as c2,
|
||||
cast(_latin1'abc' AS char(2)) as c3,
|
||||
cast(_latin1'a ' AS char(2)) as c4,
|
||||
hex(cast(_latin1'a' AS char(2))) as c5;
|
||||
c1 c2 c3 c4 c5
|
||||
ab a ab a 6100
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect BINARY(2) value: 'abc'
|
||||
Warning 1292 Truncated incorrect BINARY(2) value: 'a '
|
||||
select cast(1000 as CHAR(3));
|
||||
cast(1000 as CHAR(3))
|
||||
100
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect BINARY(3) value: '1000'
|
||||
create table t1 select
|
||||
cast(_latin1'ab' AS char) as c1,
|
||||
cast(_latin1'a ' AS char) as c2,
|
||||
cast(_latin1'abc' AS char(2)) as c3,
|
||||
cast(_latin1'a ' AS char(2)) as c4,
|
||||
cast(_latin1'a' AS char(2)) as c5;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect BINARY(2) value: 'abc'
|
||||
Warning 1292 Truncated incorrect BINARY(2) value: 'a '
|
||||
select c1,c2,c3,c4,hex(c5) from t1;
|
||||
c1 c2 c3 c4 hex(c5)
|
||||
ab a ab a 6100
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varbinary(2) NOT NULL DEFAULT '',
|
||||
`c2` varbinary(2) NOT NULL DEFAULT '',
|
||||
`c3` varbinary(2) NOT NULL DEFAULT '',
|
||||
`c4` varbinary(2) NOT NULL DEFAULT '',
|
||||
`c5` varbinary(2) NOT NULL DEFAULT ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select
|
||||
cast(_koi8r'ÆÇ' AS nchar) as c1,
|
||||
cast(_koi8r'Æ ' AS nchar) as c2,
|
||||
cast(_koi8r'ÆÇÈ' AS nchar(2)) as c3,
|
||||
cast(_koi8r'Æ ' AS nchar(2)) as c4,
|
||||
cast(_koi8r'Æ' AS nchar(2)) as c5;
|
||||
c1 c2 c3 c4 c5
|
||||
фг ф фг ф ф
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect CHAR(4) value: 'фгх'
|
||||
Warning 1292 Truncated incorrect CHAR(3) value: 'Ñ„ '
|
||||
create table t1 select
|
||||
cast(_koi8r'ÆÇ' AS nchar) as c1,
|
||||
cast(_koi8r'Æ ' AS nchar) as c2,
|
||||
cast(_koi8r'ÆÇÈ' AS nchar(2)) as c3,
|
||||
cast(_koi8r'Æ ' AS nchar(2)) as c4,
|
||||
cast(_koi8r'Æ' AS nchar(2)) as c5;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect CHAR(4) value: 'фгх'
|
||||
Warning 1292 Truncated incorrect CHAR(3) value: 'Ñ„ '
|
||||
select * from t1;
|
||||
c1 c2 c3 c4 c5
|
||||
фг ф фг ф ф
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '',
|
||||
`c2` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '',
|
||||
`c3` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '',
|
||||
`c4` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT '',
|
||||
`c5` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 (a binary(4), b char(4) character set koi8r);
|
||||
insert into t1 values (_binary'ÔÅÓÔ',_binary'ÔÅÓÔ');
|
||||
select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
|
||||
a b cast(a as char character set cp1251) cast(b as binary)
|
||||
ÔÅÓÔ ÔÅÓÔ ÔÅÓÔ ÔÅÓÔ
|
||||
set names koi8r;
|
||||
select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
|
||||
a b cast(a as char character set cp1251) cast(b as binary)
|
||||
ÔÅÓÔ ÔÅÓÔ æåõæ ÔÅÓÔ
|
||||
set names cp1251;
|
||||
select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
|
||||
a b cast(a as char character set cp1251) cast(b as binary)
|
||||
ÔÅÓÔ òåñò ÔÅÓÔ ÔÅÓÔ
|
||||
drop table t1;
|
||||
set names binary;
|
||||
select cast("2001-1-1" as date) = "2001-01-01";
|
||||
cast("2001-1-1" as date) = "2001-01-01"
|
||||
1
|
||||
select cast("2001-1-1" as datetime) = "2001-01-01 00:00:00";
|
||||
cast("2001-1-1" as datetime) = "2001-01-01 00:00:00"
|
||||
1
|
||||
select cast("1:2:3" as TIME) = "1:02:03";
|
||||
cast("1:2:3" as TIME) = "1:02:03"
|
||||
0
|
||||
select cast(NULL as DATE);
|
||||
cast(NULL as DATE)
|
||||
NULL
|
||||
select cast(NULL as BINARY);
|
||||
cast(NULL as BINARY)
|
||||
NULL
|
||||
CREATE TABLE t1 (a enum ('aac','aab','aaa') not null);
|
||||
INSERT INTO t1 VALUES ('aaa'),('aab'),('aac');
|
||||
SELECT a, CAST(a AS CHAR) FROM t1 ORDER BY CAST(a AS UNSIGNED) ;
|
||||
a CAST(a AS CHAR)
|
||||
aac aac
|
||||
aab aab
|
||||
aaa aaa
|
||||
SELECT a, CAST(a AS CHAR(3)) FROM t1 ORDER BY CAST(a AS CHAR(2)), a;
|
||||
a CAST(a AS CHAR(3))
|
||||
aac aac
|
||||
aab aab
|
||||
aaa aaa
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect BINARY(2) value: 'aaa'
|
||||
Warning 1292 Truncated incorrect BINARY(2) value: 'aab'
|
||||
Warning 1292 Truncated incorrect BINARY(2) value: 'aac'
|
||||
SELECT a, CAST(a AS UNSIGNED) FROM t1 ORDER BY CAST(a AS CHAR) ;
|
||||
a CAST(a AS UNSIGNED)
|
||||
aaa 3
|
||||
aab 2
|
||||
aac 1
|
||||
SELECT a, CAST(a AS CHAR(2)) FROM t1 ORDER BY CAST(a AS CHAR(3)), a;
|
||||
a CAST(a AS CHAR(2))
|
||||
aaa aa
|
||||
aab aa
|
||||
aac aa
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect BINARY(2) value: 'aaa'
|
||||
Warning 1292 Truncated incorrect BINARY(2) value: 'aab'
|
||||
Warning 1292 Truncated incorrect BINARY(2) value: 'aac'
|
||||
DROP TABLE t1;
|
||||
select date_add(cast('2004-12-30 12:00:00' as date), interval 0 hour);
|
||||
date_add(cast('2004-12-30 12:00:00' as date), interval 0 hour)
|
||||
2004-12-30 00:00:00
|
||||
select timediff(cast('2004-12-30 12:00:00' as time), '12:00:00');
|
||||
timediff(cast('2004-12-30 12:00:00' as time), '12:00:00')
|
||||
00:00:00
|
||||
select timediff(cast('1 12:00:00' as time), '12:00:00');
|
||||
timediff(cast('1 12:00:00' as time), '12:00:00')
|
||||
24:00:00
|
||||
select cast(18446744073709551615 as unsigned);
|
||||
cast(18446744073709551615 as unsigned)
|
||||
18446744073709551615
|
||||
select cast(18446744073709551615 as signed);
|
||||
cast(18446744073709551615 as signed)
|
||||
-1
|
||||
select cast('18446744073709551615' as unsigned);
|
||||
cast('18446744073709551615' as unsigned)
|
||||
18446744073709551615
|
||||
select cast('18446744073709551615' as signed);
|
||||
cast('18446744073709551615' as signed)
|
||||
-1
|
||||
Warnings:
|
||||
Warning 1105 Cast to signed converted positive out-of-range integer to it's negative complement
|
||||
select cast('9223372036854775807' as signed);
|
||||
cast('9223372036854775807' as signed)
|
||||
9223372036854775807
|
||||
select cast(concat('184467440','73709551615') as unsigned);
|
||||
cast(concat('184467440','73709551615') as unsigned)
|
||||
18446744073709551615
|
||||
select cast(concat('184467440','73709551615') as signed);
|
||||
cast(concat('184467440','73709551615') as signed)
|
||||
-1
|
||||
Warnings:
|
||||
Warning 1105 Cast to signed converted positive out-of-range integer to it's negative complement
|
||||
select cast(repeat('1',20) as unsigned);
|
||||
cast(repeat('1',20) as unsigned)
|
||||
11111111111111111111
|
||||
select cast(repeat('1',20) as signed);
|
||||
cast(repeat('1',20) as signed)
|
||||
-7335632962598440505
|
||||
Warnings:
|
||||
Warning 1105 Cast to signed converted positive out-of-range integer to it's negative complement
|
||||
select cast(1.0e+300 as signed int);
|
||||
cast(1.0e+300 as signed int)
|
||||
9223372036854775807
|
||||
CREATE TABLE t1 (f1 double);
|
||||
INSERT INTO t1 SET f1 = -1.0e+30 ;
|
||||
INSERT INTO t1 SET f1 = +1.0e+30 ;
|
||||
SELECT f1 AS double_val, CAST(f1 AS SIGNED INT) AS cast_val FROM t1;
|
||||
double_val cast_val
|
||||
-1e+30 -9223372036854775808
|
||||
1e+30 9223372036854775807
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1e+30'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1e+30'
|
||||
DROP TABLE t1;
|
||||
select isnull(date(NULL)), isnull(cast(NULL as DATE));
|
||||
isnull(date(NULL)) isnull(cast(NULL as DATE))
|
||||
1 1
|
||||
SELECT CAST(cast('01-01-01' as date) AS UNSIGNED);
|
||||
CAST(cast('01-01-01' as date) AS UNSIGNED)
|
||||
20010101
|
||||
SELECT CAST(cast('01-01-01' as date) AS SIGNED);
|
||||
CAST(cast('01-01-01' as date) AS SIGNED)
|
||||
20010101
|
||||
End of 4.1 tests
|
||||
select cast('1.2' as decimal(3,2));
|
||||
cast('1.2' as decimal(3,2))
|
||||
1.20
|
||||
select 1e18 * cast('1.2' as decimal(3,2));
|
||||
1e18 * cast('1.2' as decimal(3,2))
|
||||
1.2e+18
|
||||
select cast(cast('1.2' as decimal(3,2)) as signed);
|
||||
cast(cast('1.2' as decimal(3,2)) as signed)
|
||||
1
|
||||
set @v1=1e18;
|
||||
select cast(@v1 as decimal(22, 2));
|
||||
cast(@v1 as decimal(22, 2))
|
||||
1000000000000000000.00
|
||||
select cast(-1e18 as decimal(22,2));
|
||||
cast(-1e18 as decimal(22,2))
|
||||
-1000000000000000000.00
|
||||
create table t1(s1 time);
|
||||
insert into t1 values ('11:11:11');
|
||||
select cast(s1 as decimal(7,2)) from t1;
|
||||
cast(s1 as decimal(7,2))
|
||||
99999.99
|
||||
Warnings:
|
||||
Error 1264 Out of range value for column 'cast(s1 as decimal(7,2))' at row 1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (v varchar(10), tt tinytext, t text,
|
||||
mt mediumtext, lt longtext);
|
||||
INSERT INTO t1 VALUES ('1.01', '2.02', '3.03', '4.04', '5.05');
|
||||
SELECT CAST(v AS DECIMAL), CAST(tt AS DECIMAL), CAST(t AS DECIMAL),
|
||||
CAST(mt AS DECIMAL), CAST(lt AS DECIMAL) from t1;
|
||||
CAST(v AS DECIMAL) CAST(tt AS DECIMAL) CAST(t AS DECIMAL) CAST(mt AS DECIMAL) CAST(lt AS DECIMAL)
|
||||
1 2 3 4 5
|
||||
DROP TABLE t1;
|
||||
select cast(NULL as decimal(6)) as t1;
|
||||
t1
|
||||
NULL
|
||||
set names latin1;
|
||||
select hex(cast('a' as char(2) binary));
|
||||
hex(cast('a' as char(2) binary))
|
||||
61
|
||||
select hex(cast('a' as binary(2)));
|
||||
hex(cast('a' as binary(2)))
|
||||
6100
|
||||
select hex(cast('a' as char(2) binary));
|
||||
hex(cast('a' as char(2) binary))
|
||||
61
|
||||
CREATE TABLE t1 (d1 datetime);
|
||||
INSERT INTO t1(d1) VALUES ('2007-07-19 08:30:00'), (NULL),
|
||||
('2007-07-19 08:34:00'), (NULL), ('2007-07-19 08:36:00');
|
||||
SELECT cast(date(d1) as signed) FROM t1;
|
||||
cast(date(d1) as signed)
|
||||
20070719
|
||||
NULL
|
||||
20070719
|
||||
NULL
|
||||
20070719
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (f1 DATE);
|
||||
INSERT INTO t1 VALUES ('2007-07-19'), (NULL);
|
||||
SELECT HOUR(f1),
|
||||
MINUTE(f1),
|
||||
SECOND(f1) FROM t1;
|
||||
HOUR(f1) MINUTE(f1) SECOND(f1)
|
||||
0 0 0
|
||||
NULL NULL NULL
|
||||
SELECT HOUR(CAST('2007-07-19' AS DATE)),
|
||||
MINUTE(CAST('2007-07-19' AS DATE)),
|
||||
SECOND(CAST('2007-07-19' AS DATE));
|
||||
HOUR(CAST('2007-07-19' AS DATE)) MINUTE(CAST('2007-07-19' AS DATE)) SECOND(CAST('2007-07-19' AS DATE))
|
||||
0 0 0
|
||||
SELECT HOUR(CAST(NULL AS DATE)),
|
||||
MINUTE(CAST(NULL AS DATE)),
|
||||
SECOND(CAST(NULL AS DATE));
|
||||
HOUR(CAST(NULL AS DATE)) MINUTE(CAST(NULL AS DATE)) SECOND(CAST(NULL AS DATE))
|
||||
NULL NULL NULL
|
||||
SELECT HOUR(NULL),
|
||||
MINUTE(NULL),
|
||||
SECOND(NULL);
|
||||
HOUR(NULL) MINUTE(NULL) SECOND(NULL)
|
||||
NULL NULL NULL
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
#
|
||||
# Bug #44766: valgrind error when using convert() in a subquery
|
||||
#
|
||||
CREATE TABLE t1(a tinyint);
|
||||
INSERT INTO t1 VALUES (127);
|
||||
SELECT 1 FROM
|
||||
(
|
||||
SELECT CONVERT(t2.a USING UTF8) FROM t1, t1 t2 LIMIT 1
|
||||
) AS s LIMIT 1;
|
||||
1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #11765023: 57934: DOS POSSIBLE SINCE BINARY CASTING
|
||||
# DOESN'T ADHERE TO MAX_ALLOWED_PACKET
|
||||
SET @@GLOBAL.max_allowed_packet=2048;
|
||||
Warnings:
|
||||
Warning 1105 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
|
||||
SELECT CONVERT('a', BINARY(2049));
|
||||
CONVERT('a', BINARY(2049))
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 1301 Result of cast_as_binary() was larger than max_allowed_packet (2048) - truncated
|
||||
SELECT CONVERT('a', CHAR(2049));
|
||||
CONVERT('a', CHAR(2049))
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 1301 Result of cast_as_char() was larger than max_allowed_packet (2048) - truncated
|
||||
SET @@GLOBAL.max_allowed_packet=default;
|
||||
#
|
||||
# Bug#13519724 63793: CRASH IN DTCOLLATION::SET(DTCOLLATION &SET)
|
||||
#
|
||||
CREATE TABLE t1 (a VARCHAR(50));
|
||||
SELECT a FROM t1
|
||||
WHERE CAST(a as BINARY)=x'62736D697468'
|
||||
AND CAST(a AS BINARY)=x'65736D697468';
|
||||
a
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#13581962 HIGH MEMORY USAGE ATTEMPT, THEN CRASH WITH
|
||||
# LONGTEXT, UNION, USER VARIABLE
|
||||
# Bug#14096619 UNABLE TO RESTORE DATABASE DUMP
|
||||
#
|
||||
CREATE TABLE t1 AS SELECT CONCAT(CAST(REPEAT('9', 1000) AS SIGNED)),
|
||||
CONCAT(CAST(REPEAT('9', 1000) AS UNSIGNED));
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999'
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`CONCAT(CAST(REPEAT('9', 1000) AS SIGNED))` varbinary(21) NOT NULL DEFAULT '',
|
||||
`CONCAT(CAST(REPEAT('9', 1000) AS UNSIGNED))` varbinary(21) NOT NULL DEFAULT ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
# End of test for Bug#13581962, Bug#14096619
|
||||
End of 5.1 tests
|
||||
48
build/lib/mysql/mysql-test/r/change_user.result
Normal file
48
build/lib/mysql/mysql-test/r/change_user.result
Normal file
@@ -0,0 +1,48 @@
|
||||
Bug#20023
|
||||
SELECT @@session.sql_big_selects;
|
||||
@@session.sql_big_selects
|
||||
1
|
||||
SELECT @@global.max_join_size;
|
||||
@@global.max_join_size
|
||||
HA_POS_ERROR
|
||||
change_user
|
||||
SELECT @@session.sql_big_selects;
|
||||
@@session.sql_big_selects
|
||||
1
|
||||
SELECT @@global.max_join_size;
|
||||
@@global.max_join_size
|
||||
HA_POS_ERROR
|
||||
SET @@global.max_join_size = 10000;
|
||||
SET @@session.max_join_size = default;
|
||||
change_user
|
||||
SELECT @@session.sql_big_selects;
|
||||
@@session.sql_big_selects
|
||||
0
|
||||
SET @@global.max_join_size = 18446744073709551615;
|
||||
SET @@session.max_join_size = default;
|
||||
change_user
|
||||
SELECT @@session.sql_big_selects;
|
||||
@@session.sql_big_selects
|
||||
1
|
||||
Bug#31418
|
||||
SELECT IS_FREE_LOCK('bug31418');
|
||||
IS_FREE_LOCK('bug31418')
|
||||
1
|
||||
SELECT IS_USED_LOCK('bug31418');
|
||||
IS_USED_LOCK('bug31418')
|
||||
NULL
|
||||
SELECT GET_LOCK('bug31418', 1);
|
||||
GET_LOCK('bug31418', 1)
|
||||
1
|
||||
SELECT IS_USED_LOCK('bug31418') = CONNECTION_ID();
|
||||
IS_USED_LOCK('bug31418') = CONNECTION_ID()
|
||||
1
|
||||
change_user
|
||||
SELECT IS_FREE_LOCK('bug31418');
|
||||
IS_FREE_LOCK('bug31418')
|
||||
1
|
||||
SELECT IS_USED_LOCK('bug31418');
|
||||
IS_USED_LOCK('bug31418')
|
||||
NULL
|
||||
FLUSH STATUS;
|
||||
Value of com_select did not change
|
||||
25
build/lib/mysql/mysql-test/r/check.result
Normal file
25
build/lib/mysql/mysql-test/r/check.result
Normal file
@@ -0,0 +1,25 @@
|
||||
drop table if exists t1,t2;
|
||||
drop view if exists v1;
|
||||
create table t1(n int not null, key(n), key(n), key(n), key(n));
|
||||
check table t1 extended;
|
||||
insert into t1 values (200000);
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
drop table t1;
|
||||
Create table t1(f1 int);
|
||||
Create table t2(f1 int);
|
||||
Create view v1 as Select * from t1;
|
||||
Check Table v1,t2;
|
||||
Table Op Msg_type Msg_text
|
||||
test.v1 check status OK
|
||||
test.t2 check status OK
|
||||
drop view v1;
|
||||
drop table t1, t2;
|
||||
CREATE TEMPORARY TABLE t1(a INT);
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
REPAIR TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair status OK
|
||||
DROP TABLE t1;
|
||||
2
build/lib/mysql/mysql-test/r/check_var_limit.require
Normal file
2
build/lib/mysql/mysql-test/r/check_var_limit.require
Normal file
@@ -0,0 +1,2 @@
|
||||
limit
|
||||
1
|
||||
92
build/lib/mysql/mysql-test/r/client_xml.result
Normal file
92
build/lib/mysql/mysql-test/r/client_xml.result
Normal file
@@ -0,0 +1,92 @@
|
||||
set @old_concurrent_insert= @@global.concurrent_insert;
|
||||
set @@global.concurrent_insert= 0;
|
||||
drop table if exists t1;
|
||||
create table t1 (
|
||||
`a&b` int,
|
||||
`a<b` int,
|
||||
`a>b` text
|
||||
);
|
||||
insert into t1 values (1, 2, 'a&b a<b a>b');
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<resultset statement="select * from t1
|
||||
" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<row>
|
||||
<field name="a&b">1</field>
|
||||
<field name="a<b">2</field>
|
||||
<field name="a>b">a&b a<b a>b</field>
|
||||
</row>
|
||||
</resultset>
|
||||
<?xml version="1.0"?>
|
||||
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<database name="test">
|
||||
<table_structure name="t1">
|
||||
<field Field="a&b" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
|
||||
<field Field="a<b" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
|
||||
<field Field="a>b" Type="text" Null="YES" Key="" Extra="" Comment="" />
|
||||
</table_structure>
|
||||
<table_data name="t1">
|
||||
<row>
|
||||
<field name="a&b">1</field>
|
||||
<field name="a<b">2</field>
|
||||
<field name="a>b">a&b a<b a>b</field>
|
||||
</row>
|
||||
</table_data>
|
||||
</database>
|
||||
</mysqldump>
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<resultset statement="select count(*) from t1
|
||||
" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<row>
|
||||
<field name="count(*)">1</field>
|
||||
</row>
|
||||
</resultset>
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<resultset statement="select 1 < 2 from dual
|
||||
" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<row>
|
||||
<field name="1 < 2">1</field>
|
||||
</row>
|
||||
</resultset>
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<resultset statement="select 1 > 2 from dual
|
||||
" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<row>
|
||||
<field name="1 > 2">0</field>
|
||||
</row>
|
||||
</resultset>
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<resultset statement="select 1 & 3 from dual
|
||||
" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<row>
|
||||
<field name="1 & 3">1</field>
|
||||
</row>
|
||||
</resultset>
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<resultset statement="select null from dual
|
||||
" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<row>
|
||||
<field name="NULL" xsi:nil="true" />
|
||||
</row>
|
||||
</resultset>
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<resultset statement="select 1 limit 0
|
||||
" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></resultset>
|
||||
--------------
|
||||
select 1 limit 0
|
||||
--------------
|
||||
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<resultset statement="select 1 limit 0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></resultset>
|
||||
Empty set
|
||||
|
||||
Bye
|
||||
drop table t1;
|
||||
set @@global.concurrent_insert= @old_concurrent_insert;
|
||||
53
build/lib/mysql/mysql-test/r/comments.result
Normal file
53
build/lib/mysql/mysql-test/r/comments.result
Normal file
@@ -0,0 +1,53 @@
|
||||
select 1+2/*hello*/+3;
|
||||
1+2/*hello*/+3
|
||||
6
|
||||
select 1 /* long
|
||||
multi line comment */;
|
||||
1
|
||||
1
|
||||
;
|
||||
ERROR 42000: Query was empty
|
||||
select 1 /*!32301 +1 */;
|
||||
1 +1
|
||||
2
|
||||
select 1 /*!52301 +1 */;
|
||||
1
|
||||
1
|
||||
select 1--1;
|
||||
1--1
|
||||
2
|
||||
select 1 --2
|
||||
+1;
|
||||
1 --2
|
||||
+1
|
||||
4
|
||||
select 1 # The rest of the row will be ignored
|
||||
;
|
||||
1
|
||||
1
|
||||
/* line with only comment */;
|
||||
select 1/*!2*/;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2*/' at line 1
|
||||
select 1/*!000002*/;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2*/' at line 1
|
||||
select 1/*!999992*/;
|
||||
1
|
||||
1
|
||||
select 1 + /*!00000 2 */ + 3 /*!99999 noise*/ + 4;
|
||||
1 + 2 + 3 + 4
|
||||
10
|
||||
drop table if exists table_28779;
|
||||
create table table_28779 (a int);
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*' AND b = 'bar';";
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*' AND b = 'bar'' at line 1
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*' AND b = 'bar';*";
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*' AND b = 'bar';*' at line 1
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*! AND 2=2;";
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*! AND 2=2;*";
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*' at line 1
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*!98765' AND b = 'bar';";
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*!98765' AND b = 'bar'' at line 1
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*!98765' AND b = 'bar';*";
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*!98765' AND b = 'bar';*' at line 1
|
||||
drop table table_28779;
|
||||
891
build/lib/mysql/mysql-test/r/commit_1innodb.result
Normal file
891
build/lib/mysql/mysql-test/r/commit_1innodb.result
Normal file
@@ -0,0 +1,891 @@
|
||||
set sql_mode=no_engine_substitution;
|
||||
set storage_engine = InnoDB;
|
||||
set autocommit=1;
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
drop table if exists t3;
|
||||
drop function if exists f2;
|
||||
drop procedure if exists bug12713_call;
|
||||
drop procedure if exists bug12713_dump_spvars;
|
||||
drop procedure if exists dummy;
|
||||
create table t1 (a int);
|
||||
create table t2 (a int unique);
|
||||
create table t3 (a int);
|
||||
set sql_mode=default;
|
||||
insert into t1 (a) values (1), (2);
|
||||
insert into t3 (a) values (1), (2);
|
||||
create function f2(x int) returns int
|
||||
begin
|
||||
insert into t2 (a) values (x);
|
||||
insert into t2 (a) values (x);
|
||||
return x;
|
||||
end|
|
||||
set autocommit=0;
|
||||
flush status;
|
||||
insert into t2 (a) values (1001);
|
||||
insert into t1 (a) values (f2(1));
|
||||
ERROR 23000: Duplicate entry '1' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1001
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1002);
|
||||
insert into t3 (a) select f2(2) from t1;
|
||||
ERROR 23000: Duplicate entry '2' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1002
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1003);
|
||||
update t1 set a= a + f2(3);
|
||||
ERROR 23000: Duplicate entry '3' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1003
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1004);
|
||||
update t1, t3 set t1.a = 0, t3.a = 0 where (f2(4) = 4) and (t1.a = t3.a);
|
||||
ERROR 23000: Duplicate entry '4' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1004
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1005);
|
||||
delete from t1 where (a = f2(5));
|
||||
ERROR 23000: Duplicate entry '5' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1005
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1006);
|
||||
delete from t1, t3 using t1, t3 where (f2(6) = 6) ;
|
||||
ERROR 23000: Duplicate entry '6' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1006
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1007);
|
||||
replace t1 values (f2(7));
|
||||
ERROR 23000: Duplicate entry '7' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1007
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1008);
|
||||
replace into t3 (a) select f2(8) from t1;
|
||||
ERROR 23000: Duplicate entry '8' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1008
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1009);
|
||||
select f2(9) from t1 ;
|
||||
ERROR 23000: Duplicate entry '9' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1009
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1010);
|
||||
show databases where (f2(10) = 10);
|
||||
ERROR 23000: Duplicate entry '10' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1010
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1011);
|
||||
show tables where (f2(11) = 11);
|
||||
ERROR 23000: Duplicate entry '11' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1011
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1012);
|
||||
show triggers where (f2(12) = 12);
|
||||
ERROR 23000: Duplicate entry '12' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1012
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1013);
|
||||
show table status where (f2(13) = 13);
|
||||
ERROR 23000: Duplicate entry '13' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1013
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1014);
|
||||
show open tables where (f2(14) = 14);
|
||||
ERROR 23000: Duplicate entry '14' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1014
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1015);
|
||||
show columns in mysql.proc where (f2(15) = 15);
|
||||
ERROR 23000: Duplicate entry '15' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1015
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1016);
|
||||
show status where (f2(16) = 16);
|
||||
ERROR 23000: Duplicate entry '16' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1016
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1017);
|
||||
show variables where (f2(17) = 17);
|
||||
ERROR 23000: Duplicate entry '17' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1017
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1018);
|
||||
show charset where (f2(18) = 18);
|
||||
ERROR 23000: Duplicate entry '18' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1018
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1019);
|
||||
show collation where (f2(19) = 19);
|
||||
ERROR 23000: Duplicate entry '19' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1019
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
# We need at least one procedure to make sure the WHERE clause is
|
||||
# evaluated
|
||||
create procedure dummy() begin end;
|
||||
insert into t2 (a) values (1020);
|
||||
show procedure status where (f2(20) = 20);
|
||||
ERROR 23000: Duplicate entry '20' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1020
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
drop procedure dummy;
|
||||
insert into t2 (a) values (1021);
|
||||
show function status where (f2(21) = 21);
|
||||
ERROR 23000: Duplicate entry '21' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1021
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1022);
|
||||
prepare stmt from "insert into t1 (a) values (f2(22))";
|
||||
execute stmt;
|
||||
ERROR 23000: Duplicate entry '22' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1022
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1023);
|
||||
do (f2(23));
|
||||
Warnings:
|
||||
Error 1062 Duplicate entry '23' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1023
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
create procedure bug12713_call ()
|
||||
begin
|
||||
insert into t2 (a) values (24);
|
||||
insert into t2 (a) values (24);
|
||||
end|
|
||||
insert into t2 (a) values (1024);
|
||||
call bug12713_call();
|
||||
ERROR 23000: Duplicate entry '24' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
24
|
||||
1024
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
=======================================================================
|
||||
Testing select_to_file
|
||||
=======================================================================
|
||||
insert into t2 (a) values (1025);
|
||||
select f2(25) into outfile "../tmp/dml.out" from t1;
|
||||
ERROR 23000: Duplicate entry '25' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1025
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
insert into t2 (a) values (1026);
|
||||
load data infile "../../std_data/words.dat" into table t1 (a) set a:=f2(26);
|
||||
ERROR 23000: Duplicate entry '26' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1026
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
=======================================================================
|
||||
Testing select_dumpvar
|
||||
=======================================================================
|
||||
insert into t2 (a) values (1027);
|
||||
select f2(27) into @foo;
|
||||
ERROR 23000: Duplicate entry '27' for key 'a'
|
||||
select * from t2;
|
||||
a
|
||||
1027
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
=======================================================================
|
||||
Testing Select_fetch_into_spvars
|
||||
=======================================================================
|
||||
create procedure bug12713_dump_spvars ()
|
||||
begin
|
||||
declare foo int;
|
||||
declare continue handler for sqlexception
|
||||
begin
|
||||
select "Exception trapped";
|
||||
end;
|
||||
select f2(28) into foo;
|
||||
select * from t2;
|
||||
end|
|
||||
insert into t2 (a) values (1028);
|
||||
call bug12713_dump_spvars ();
|
||||
Exception trapped
|
||||
Exception trapped
|
||||
a
|
||||
1028
|
||||
rollback;
|
||||
select * from t2;
|
||||
a
|
||||
=======================================================================
|
||||
Cleanup
|
||||
=======================================================================
|
||||
set autocommit=default;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
drop function f2;
|
||||
drop procedure bug12713_call;
|
||||
drop procedure bug12713_dump_spvars;
|
||||
#
|
||||
# Bug#12713 Error in a stored function called from a SELECT doesn't
|
||||
# cause ROLLBACK of statem
|
||||
#
|
||||
# Verify that two-phase commit is not issued for read-only
|
||||
# transactions.
|
||||
#
|
||||
# Verify that two-phase commit is issued for read-write transactions,
|
||||
# even if the change is done inside a stored function called from
|
||||
# SELECT or SHOW statement.
|
||||
#
|
||||
set autocommit=0;
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
drop function if exists f1;
|
||||
drop procedure if exists p_verify_status_increment;
|
||||
set @binlog_format=@@global.binlog_format;
|
||||
set sql_mode=no_engine_substitution;
|
||||
create table t1 (a int unique);
|
||||
create table t2 (a int) engine=myisam;
|
||||
set sql_mode=default;
|
||||
#
|
||||
# An auxiliary procedure to track Handler_prepare and Handler_commit
|
||||
# statistics.
|
||||
#
|
||||
create procedure
|
||||
p_verify_status_increment(commit_inc_mixed int, prepare_inc_mixed int,
|
||||
commit_inc_row int, prepare_inc_row int)
|
||||
begin
|
||||
declare commit_inc int;
|
||||
declare prepare_inc int;
|
||||
declare old_commit_count int default ifnull(@commit_count, 0);
|
||||
declare old_prepare_count int default ifnull(@prepare_count, 0);
|
||||
declare c_res int;
|
||||
# Use a cursor to have just one access to I_S instead of 2, it is very slow
|
||||
# and amounts for over 90% of test CPU time
|
||||
declare c cursor for
|
||||
select variable_value
|
||||
from information_schema.session_status
|
||||
where variable_name='Handler_commit' or variable_name='Handler_prepare'
|
||||
order by variable_name;
|
||||
if @binlog_format = 'ROW' then
|
||||
set commit_inc= commit_inc_row;
|
||||
set prepare_inc= prepare_inc_row;
|
||||
else
|
||||
set commit_inc= commit_inc_mixed;
|
||||
set prepare_inc= prepare_inc_mixed;
|
||||
end if;
|
||||
open c;
|
||||
fetch c into c_res;
|
||||
set @commit_count=c_res;
|
||||
fetch c into c_res;
|
||||
set @prepare_count=c_res;
|
||||
close c;
|
||||
if old_commit_count + commit_inc <> @commit_count then
|
||||
select concat("Expected commit increment: ", commit_inc,
|
||||
" actual: ", @commit_count - old_commit_count)
|
||||
as 'ERROR';
|
||||
elseif old_prepare_count + prepare_inc <> @prepare_count then
|
||||
select concat("Expected prepare increment: ", prepare_inc,
|
||||
" actual: ", @prepare_count - old_prepare_count)
|
||||
as 'ERROR';
|
||||
else
|
||||
select '' as 'SUCCESS';
|
||||
end if;
|
||||
end|
|
||||
# Reset Handler_commit and Handler_prepare counters
|
||||
flush status;
|
||||
#
|
||||
# 1. Read-only statement: SELECT
|
||||
#
|
||||
select * from t1;
|
||||
a
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 2. Read-write statement: INSERT, insert 1 row.
|
||||
#
|
||||
insert into t1 (a) values (1);
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
# 3. Read-write statement: UPDATE, update 1 row.
|
||||
#
|
||||
update t1 set a=2;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
# 4. Read-write statement: UPDATE, update 0 rows, 1 row matches WHERE
|
||||
#
|
||||
update t1 set a=2;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 5. Read-write statement: UPDATE, update 0 rows, 0 rows match WHERE
|
||||
#
|
||||
# In mixed replication mode, there is a read-only transaction
|
||||
# in InnoDB and also the statement is written to the binary log.
|
||||
# So we have two commits but no 2pc, since the first engine's
|
||||
# transaction is read-only.
|
||||
# In the row level replication mode, we only have the read-only
|
||||
# transaction in InnoDB and nothing is written to the binary log.
|
||||
#
|
||||
update t1 set a=3 where a=1;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 6. Read-write statement: DELETE, delete 0 rows.
|
||||
#
|
||||
delete from t1 where a=1;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 7. Read-write statement: DELETE, delete 1 row.
|
||||
#
|
||||
delete from t1 where a=2;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
# 8. Read-write statement: unqualified DELETE
|
||||
#
|
||||
# In statement or mixed replication mode, we call
|
||||
# handler::ha_delete_all_rows() and write statement text
|
||||
# to the binary log. This results in two read-write transactions.
|
||||
# In row level replication mode, we do not call
|
||||
# handler::ha_delete_all_rows(), but delete rows one by one.
|
||||
# Since there are no rows, nothing is written to the binary log.
|
||||
# Thus we have just one read-only transaction in InnoDB.
|
||||
delete from t1;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 9. Read-write statement: REPLACE, change 1 row.
|
||||
#
|
||||
replace t1 set a=1;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
# 10. Read-write statement: REPLACE, change 0 rows.
|
||||
#
|
||||
replace t1 set a=1;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 11. Read-write statement: IODKU, change 1 row.
|
||||
#
|
||||
insert t1 set a=1 on duplicate key update a=a+1;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
select * from t1;
|
||||
a
|
||||
2
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
# 12. Read-write statement: IODKU, change 0 rows.
|
||||
#
|
||||
insert t1 set a=2 on duplicate key update a=2;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 13. Read-write statement: INSERT IGNORE, change 0 rows.
|
||||
#
|
||||
insert ignore t1 set a=2;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 14. Read-write statement: INSERT IGNORE, change 1 row.
|
||||
#
|
||||
insert ignore t1 set a=1;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
# 15. Read-write statement: UPDATE IGNORE, change 0 rows.
|
||||
#
|
||||
update ignore t1 set a=2 where a=1;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
#
|
||||
# Create a stored function that modifies a
|
||||
# non-transactional table. Demonstrate that changes in
|
||||
# non-transactional tables do not affect the two phase commit
|
||||
# algorithm.
|
||||
#
|
||||
create function f1() returns int
|
||||
begin
|
||||
insert t2 set a=2;
|
||||
return 2;
|
||||
end|
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
# 16. A function changes non-trans-table.
|
||||
#
|
||||
# For row-based logging, there is an extra commit for the
|
||||
# non-transactional changes saved in the transaction cache to
|
||||
# the binary log.
|
||||
#
|
||||
select f1();
|
||||
f1()
|
||||
2
|
||||
call p_verify_status_increment(0, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(0, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 17. Read-only statement, a function changes non-trans-table.
|
||||
#
|
||||
# For row-based logging, there is an extra commit for the
|
||||
# non-transactional changes saved in the transaction cache to
|
||||
# the binary log.
|
||||
#
|
||||
select f1() from t1;
|
||||
f1()
|
||||
2
|
||||
2
|
||||
call p_verify_status_increment(1, 0, 2, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(1, 0, 2, 0);
|
||||
SUCCESS
|
||||
|
||||
# 18. Read-write statement: UPDATE, change 0 (transactional) rows.
|
||||
#
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
3
|
||||
update t1 set a=2 where a=f1()+10;
|
||||
select count(*) from t2;
|
||||
count(*)
|
||||
5
|
||||
call p_verify_status_increment(2, 0, 2, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 0, 2, 0);
|
||||
SUCCESS
|
||||
|
||||
#
|
||||
# Replace the non-transactional table with a temporary
|
||||
# transactional table. Demonstrate that a change to a temporary
|
||||
# transactional table does not provoke 2-phase commit, although
|
||||
# does trigger a commit and a binlog write (in statement mode).
|
||||
#
|
||||
drop table t2;
|
||||
set sql_mode=no_engine_substitution;
|
||||
create temporary table t2 (a int);
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
set sql_mode=default;
|
||||
# 19. A function changes temp-trans-table.
|
||||
#
|
||||
select f1();
|
||||
f1()
|
||||
2
|
||||
# Two commits because a binary log record is written
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 20. Read-only statement, a function changes non-trans-table.
|
||||
#
|
||||
select f1() from t1;
|
||||
f1()
|
||||
2
|
||||
2
|
||||
# Two commits because a binary log record is written
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 21. Read-write statement: UPDATE, change 0 (transactional) rows.
|
||||
#
|
||||
update t1 set a=2 where a=f1()+10;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 22. DDL: ALTER TEMPORARY TABLE, should not cause a 2pc
|
||||
#
|
||||
alter table t2 add column b int default 5;
|
||||
# A commit is done internally by ALTER.
|
||||
call p_verify_status_increment(2, 0, 2, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
# There is nothing left to commit
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
# 23. DDL: RENAME TEMPORARY TABLE, does not start a transaction
|
||||
|
||||
# No test because of Bug#8729 "rename table fails on temporary table"
|
||||
# 24. DDL: TRUNCATE TEMPORARY TABLE
|
||||
|
||||
truncate table t2;
|
||||
call p_verify_status_increment(4, 0, 4, 0);
|
||||
ERROR
|
||||
Expected commit increment: 4 actual: 2
|
||||
commit;
|
||||
# There is nothing left to commit
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
# 25. Read-write statement: unqualified DELETE
|
||||
|
||||
delete from t2;
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
# There is nothing left to commit
|
||||
call p_verify_status_increment(2, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 25. DDL: DROP TEMPORARY TABLE, does not start a transaction
|
||||
#
|
||||
drop temporary table t2;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
# 26. Verify that SET AUTOCOMMIT issues an implicit commit
|
||||
#
|
||||
insert t1 set a=3;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
set autocommit=1;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
rollback;
|
||||
select a from t1 where a=3;
|
||||
a
|
||||
3
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
delete from t1 where a=3;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
set autocommit=0;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
insert t1 set a=3;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
# Sic: not actually changing the value of autocommit
|
||||
set autocommit=0;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
rollback;
|
||||
select a from t1 where a=3;
|
||||
a
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 27. Savepoint management
|
||||
#
|
||||
insert t1 set a=3;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
savepoint a;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
insert t1 set a=4;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
release savepoint a;
|
||||
rollback;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
select a from t1 where a=3;
|
||||
a
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
# 28. Read-write statement: DO
|
||||
#
|
||||
create table t2 (a int);
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
do (select f1() from t1 where a=2);
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
# 29. Read-write statement: MULTI-DELETE
|
||||
#
|
||||
delete t1, t2 from t1 join t2 on (t1.a=t2.a) where t1.a=2;
|
||||
commit;
|
||||
call p_verify_status_increment(4, 4, 4, 4);
|
||||
SUCCESS
|
||||
|
||||
# 30. Read-write statement: INSERT-SELECT, MULTI-UPDATE, REPLACE-SELECT
|
||||
#
|
||||
insert into t2 select a from t1;
|
||||
commit;
|
||||
replace into t2 select a from t1;
|
||||
commit;
|
||||
call p_verify_status_increment(8, 8, 8, 8);
|
||||
SUCCESS
|
||||
|
||||
update t1, t2 set t1.a=4, t2.a=8 where t1.a=t2.a and t1.a=1;
|
||||
commit;
|
||||
call p_verify_status_increment(4, 4, 4, 4);
|
||||
SUCCESS
|
||||
|
||||
# 31. DDL: various DDL with transactional tables
|
||||
#
|
||||
# Sic: no table is created.
|
||||
create table if not exists t2 (a int) select 6 union select 7;
|
||||
Warnings:
|
||||
Note 1050 Table 't2' already exists
|
||||
# Sic: first commits the statement, and then the transaction.
|
||||
call p_verify_status_increment(4, 4, 4, 4);
|
||||
SUCCESS
|
||||
|
||||
create table t3 select a from t2;
|
||||
call p_verify_status_increment(4, 4, 4, 4);
|
||||
SUCCESS
|
||||
|
||||
alter table t3 add column (b int);
|
||||
call p_verify_status_increment(2, 0, 2, 0);
|
||||
SUCCESS
|
||||
|
||||
alter table t3 rename t4;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
rename table t4 to t3;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
truncate table t3;
|
||||
call p_verify_status_increment(4, 4, 4, 4);
|
||||
SUCCESS
|
||||
|
||||
create view v1 as select * from t2;
|
||||
call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
call p_verify_status_increment(3, 0, 3, 0);
|
||||
SUCCESS
|
||||
|
||||
# Sic: after this bug is fixed, CHECK leaves no pending transaction
|
||||
commit;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
check table t1, t2, t3;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
test.t2 check status OK
|
||||
test.t3 check status OK
|
||||
call p_verify_status_increment(6, 0, 6, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
drop view v1;
|
||||
call p_verify_status_increment(0, 0, 0, 0);
|
||||
SUCCESS
|
||||
|
||||
#
|
||||
# Cleanup
|
||||
#
|
||||
drop table t1, t2, t3;
|
||||
drop procedure p_verify_status_increment;
|
||||
drop function f1;
|
||||
98
build/lib/mysql/mysql-test/r/compare.result
Normal file
98
build/lib/mysql/mysql-test/r/compare.result
Normal file
@@ -0,0 +1,98 @@
|
||||
drop table if exists t1;
|
||||
CREATE TABLE t1 (id CHAR(12) not null, PRIMARY KEY (id));
|
||||
insert into t1 values ('000000000001'),('000000000002');
|
||||
explain select * from t1 where id=000000000001;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index PRIMARY PRIMARY 12 NULL 2 Using where; Using index
|
||||
select * from t1 where id=000000000001;
|
||||
id
|
||||
000000000001
|
||||
delete from t1 where id=000000000002;
|
||||
select * from t1;
|
||||
id
|
||||
000000000001
|
||||
drop table t1;
|
||||
SELECT 'a' = 'a ';
|
||||
'a' = 'a '
|
||||
1
|
||||
SELECT 'a\0' < 'a';
|
||||
'a\0' < 'a'
|
||||
1
|
||||
SELECT 'a\0' < 'a ';
|
||||
'a\0' < 'a '
|
||||
1
|
||||
SELECT 'a\t' < 'a';
|
||||
'a\t' < 'a'
|
||||
1
|
||||
SELECT 'a\t' < 'a ';
|
||||
'a\t' < 'a '
|
||||
1
|
||||
CREATE TABLE t1 (a char(10) not null);
|
||||
INSERT INTO t1 VALUES ('a'),('a\0'),('a\t'),('a ');
|
||||
SELECT hex(a),STRCMP(a,'a'), STRCMP(a,'a ') FROM t1;
|
||||
hex(a) STRCMP(a,'a') STRCMP(a,'a ')
|
||||
61 0 0
|
||||
6100 -1 -1
|
||||
6109 -1 -1
|
||||
61 0 0
|
||||
DROP TABLE t1;
|
||||
SELECT CHAR(31) = '', '' = CHAR(31);
|
||||
CHAR(31) = '' '' = CHAR(31)
|
||||
0 0
|
||||
SELECT CHAR(30) = '', '' = CHAR(30);
|
||||
CHAR(30) = '' '' = CHAR(30)
|
||||
0 0
|
||||
create table t1 (a tinyint(1),b binary(1));
|
||||
insert into t1 values (0x01,0x01);
|
||||
select * from t1 where a=b;
|
||||
a b
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: ''
|
||||
select * from t1 where a=b and b=0x01;
|
||||
a b
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: ''
|
||||
drop table if exists t1;
|
||||
CREATE TABLE t1 (b int(2) zerofill, c int(2) zerofill);
|
||||
INSERT INTO t1 (b,c) VALUES (1,2), (1,1), (2,2);
|
||||
SELECT CONCAT(b,c), CONCAT(b,c) = '0101' FROM t1;
|
||||
CONCAT(b,c) CONCAT(b,c) = '0101'
|
||||
0102 0
|
||||
0101 1
|
||||
0202 0
|
||||
EXPLAIN EXTENDED SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101';
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`b` = 1) and (concat('01',`test`.`t1`.`c`) = '0101'))
|
||||
SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101';
|
||||
b c
|
||||
01 01
|
||||
CREATE TABLE t2 (a int);
|
||||
INSERT INTO t2 VALUES (1),(2);
|
||||
SELECT a,
|
||||
(SELECT COUNT(*) FROM t1
|
||||
WHERE b = t2.a AND CONCAT(b,c) = CONCAT('0',t2.a,'01')) x
|
||||
FROM t2 ORDER BY a;
|
||||
a x
|
||||
1 1
|
||||
2 0
|
||||
EXPLAIN EXTENDED
|
||||
SELECT a,
|
||||
(SELECT COUNT(*) FROM t1
|
||||
WHERE b = t2.a AND CONCAT(b,c) = CONCAT('0',t2.a,'01')) x
|
||||
FROM t2 ORDER BY a;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using filesort
|
||||
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,(select count(0) from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t2`.`a`) and (concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = concat('0',`test`.`t2`.`a`,'01')))) AS `x` from `test`.`t2` order by `test`.`t2`.`a`
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (a TIMESTAMP);
|
||||
INSERT INTO t1 VALUES (NOW()),(NOW()),(NOW());
|
||||
SELECT * FROM t1 WHERE a > '2008-01-01' AND a = '0000-00-00';
|
||||
a
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
2162
build/lib/mysql/mysql-test/r/compress.result
Normal file
2162
build/lib/mysql/mysql-test/r/compress.result
Normal file
File diff suppressed because it is too large
Load Diff
792
build/lib/mysql/mysql-test/r/concurrent_innodb_safelog.result
Normal file
792
build/lib/mysql/mysql-test/r/concurrent_innodb_safelog.result
Normal file
@@ -0,0 +1,792 @@
|
||||
SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
SELECT @@global.innodb_locks_unsafe_for_binlog;
|
||||
@@global.innodb_locks_unsafe_for_binlog
|
||||
0
|
||||
# keep_locks == 1
|
||||
GRANT USAGE ON test.* TO mysqltest@localhost;
|
||||
drop table if exists t1;
|
||||
|
||||
**
|
||||
** two UPDATE's running and both changing distinct result sets
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** Get user level lock (ULL) for thread 1
|
||||
select get_lock("hello",10);
|
||||
get_lock("hello",10)
|
||||
1
|
||||
** connection thread2
|
||||
** Start transaction for thread 2
|
||||
begin;
|
||||
** Update will cause a table scan and a new ULL will
|
||||
** be created and blocked on the first row where tipo=11.
|
||||
update t1 set eta=1+get_lock("hello",10)*0 where tipo=11;
|
||||
** connection thread1
|
||||
** Start new transaction for thread 1
|
||||
begin;
|
||||
** Update on t1 will cause a table scan which will be blocked because
|
||||
** the previously initiated table scan applied exclusive key locks on
|
||||
** all primary keys.
|
||||
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
** do not match the WHERE condition are released.
|
||||
update t1 set eta=2 where tipo=22;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
** Release user level name lock from thread 1. This will cause the ULL
|
||||
** on thread 2 to end its wait.
|
||||
DO release_lock("hello");
|
||||
** Table is now updated with a new eta on tipo=22 for thread 1.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** Release the lock and collect result from update on thread 2
|
||||
DO release_lock("hello");
|
||||
** Table should have eta updates where tipo=11 but updates made by
|
||||
** thread 1 shouldn't be visible yet.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** Sending commit on thread 2.
|
||||
commit;
|
||||
** connection thread1
|
||||
** Make sure table reads didn't change yet on thread 1.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** And send final commit on thread 1.
|
||||
commit;
|
||||
** Table should now be updated by both updates in the order of
|
||||
** thread 1,2.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** Make sure the output is similar for t1.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** two UPDATE's running and one changing result set
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** Get ULL "hello" on thread 1
|
||||
select get_lock("hello",10);
|
||||
get_lock("hello",10)
|
||||
1
|
||||
** connection thread2
|
||||
** Start transaction on thread 2
|
||||
begin;
|
||||
** Update will cause a table scan.
|
||||
** This will cause a hang on the first row where tipo=1 until the
|
||||
** blocking ULL is released.
|
||||
update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
|
||||
** connection thread1
|
||||
** Start transaction on thread 1
|
||||
begin;
|
||||
** Update on t1 will cause a table scan which will be blocked because
|
||||
** the previously initiated table scan applied exclusive key locks on
|
||||
** all primary keys.
|
||||
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
** do not match the WHERE condition are released.
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
** Release ULL. This will release the next waiting ULL on thread 2.
|
||||
DO release_lock("hello");
|
||||
** The table should still be updated with updates for thread 1 only:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** Release the lock and collect result from thread 2:
|
||||
DO release_lock("hello");
|
||||
** Seen from thread 2 the table should have been updated on four
|
||||
** places.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
1 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
1 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
1 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** connection thread1
|
||||
** Thread 2 has committed but the result should remain the same for
|
||||
** thread 1 (updated on three places):
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** After a commit the table should be merged with the previous
|
||||
** commit.
|
||||
** This select should show both updates:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
1 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
1 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
1 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
1 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
1 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
1 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
1 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
1 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
1 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** One UPDATE and one INSERT .... Monty's test
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1 (a int not null, b int not null);
|
||||
insert into t1 values (1,1),(2,1),(3,1),(4,1);
|
||||
** Create ULL 'hello2'
|
||||
select get_lock("hello2",10);
|
||||
get_lock("hello2",10)
|
||||
1
|
||||
** connection thread2
|
||||
** Begin a new transaction on thread 2
|
||||
begin;
|
||||
** Update will create a table scan which creates a ULL where a=2;
|
||||
** this will hang waiting on thread 1.
|
||||
update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2;
|
||||
** connection thread1
|
||||
** Insert new values to t1 from thread 1; this created an implicit
|
||||
** commit since there are no on-going transactions.
|
||||
insert into t1 values (1,1);
|
||||
** Release the ULL (thread 2 updates will finish).
|
||||
DO release_lock("hello2");
|
||||
** ..but thread 1 will still see t1 as if nothing has happend:
|
||||
select * from t1;
|
||||
a b
|
||||
1 1
|
||||
2 1
|
||||
3 1
|
||||
4 1
|
||||
1 1
|
||||
** connection thread2
|
||||
** Collect results from thread 2 and release the lock.
|
||||
DO release_lock("hello2");
|
||||
** The table should look like the original+updates for thread 2,
|
||||
** and consist of new rows:
|
||||
select * from t1;
|
||||
a b
|
||||
1 1
|
||||
2 10
|
||||
3 1
|
||||
4 1
|
||||
1 1
|
||||
** Commit changes from thread 2
|
||||
commit;
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** one UPDATE changing result set and SELECT ... FOR UPDATE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** connection thread2
|
||||
** Begin a new transaction on thread 2
|
||||
begin;
|
||||
** Select a range for update.
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
eta tipo c
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
** connection thread1
|
||||
** Begin a new transaction on thread 1
|
||||
begin;
|
||||
** Update the same range which is marked for update on thread 2; this
|
||||
** will hang because of row locks.
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
** After the update the table will be unmodified because the previous
|
||||
** transaction failed and was rolled back.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** The table should look unmodified from thread 2.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** Sending a commit should release the row locks and enable
|
||||
** thread 1 to complete the transaction.
|
||||
commit;
|
||||
** connection thread1
|
||||
** Commit on thread 1.
|
||||
commit;
|
||||
** connection thread2
|
||||
** The table should not have been changed.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
** Even on thread 1:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** one UPDATE not changing result set and SELECT ... FOR UPDATE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** connection thread2
|
||||
** Starting new transaction on thread 2.
|
||||
begin;
|
||||
** Starting SELECT .. FOR UPDATE
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
eta tipo c
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
** connection thread1
|
||||
|
||||
** Starting new transaction on thread 1
|
||||
begin;
|
||||
** Updating single row using a table scan. This will time out
|
||||
** because of ongoing transaction on thread 1 holding lock on
|
||||
** all primary keys in the scan.
|
||||
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
** do not match the WHERE condition are released.
|
||||
update t1 set tipo=11 where tipo=22;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
** After the time out the transaction is aborted; no rows should
|
||||
** have changed.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** The same thing should hold true for the transaction on
|
||||
** thread 2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** connection thread1
|
||||
commit;
|
||||
** connection thread2
|
||||
** Even after committing:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** two SELECT ... FOR UPDATE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** connection thread2
|
||||
** Begin a new transaction on thread 2
|
||||
begin;
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
eta tipo c
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
** connection thread1
|
||||
** Begin a new transaction on thread 1
|
||||
begin;
|
||||
** Selecting a range for update by table scan will be blocked
|
||||
** because of on-going transaction on thread 2.
|
||||
select * from t1 where tipo=1 FOR UPDATE;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
** connection thread2
|
||||
** Table will be unchanged and the select command will not be
|
||||
** blocked:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** Commit transacton on thread 2.
|
||||
commit;
|
||||
** connection thread1
|
||||
** Commit transaction on thread 1.
|
||||
commit;
|
||||
** connection thread2
|
||||
** Make sure table isn't blocked on thread 2:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
** Make sure table isn't blocked on thread 1:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** one UPDATE changing result set and DELETE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** connection thread2
|
||||
begin;
|
||||
delete from t1 where tipo=2;
|
||||
** connection thread1
|
||||
begin;
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** connection thread1
|
||||
commit;
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** one UPDATE not changing result set and DELETE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** connection thread2
|
||||
begin;
|
||||
delete from t1 where tipo=2;
|
||||
** connection thread1
|
||||
begin;
|
||||
** Update on t1 will cause a table scan which will be blocked because
|
||||
** the previously initiated table scan applied exclusive key locks on
|
||||
** all primary keys.
|
||||
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
** do not match the WHERE condition are released.
|
||||
update t1 set tipo=1 where tipo=22;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** connection thread1
|
||||
commit;
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** Cleanup
|
||||
** connection thread2
|
||||
** connection default
|
||||
drop table t1;
|
||||
drop user mysqltest@localhost;
|
||||
788
build/lib/mysql/mysql-test/r/concurrent_innodb_unsafelog.result
Normal file
788
build/lib/mysql/mysql-test/r/concurrent_innodb_unsafelog.result
Normal file
@@ -0,0 +1,788 @@
|
||||
SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
SELECT @@global.innodb_locks_unsafe_for_binlog;
|
||||
@@global.innodb_locks_unsafe_for_binlog
|
||||
1
|
||||
# keep_locks == 0
|
||||
GRANT USAGE ON test.* TO mysqltest@localhost;
|
||||
drop table if exists t1;
|
||||
|
||||
**
|
||||
** two UPDATE's running and both changing distinct result sets
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** Get user level lock (ULL) for thread 1
|
||||
select get_lock("hello",10);
|
||||
get_lock("hello",10)
|
||||
1
|
||||
** connection thread2
|
||||
** Start transaction for thread 2
|
||||
begin;
|
||||
** Update will cause a table scan and a new ULL will
|
||||
** be created and blocked on the first row where tipo=11.
|
||||
update t1 set eta=1+get_lock("hello",10)*0 where tipo=11;
|
||||
** connection thread1
|
||||
** Start new transaction for thread 1
|
||||
begin;
|
||||
** Update on t1 will cause a table scan which will be blocked because
|
||||
** the previously initiated table scan applied exclusive key locks on
|
||||
** all primary keys.
|
||||
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
** do not match the WHERE condition are released.
|
||||
update t1 set eta=2 where tipo=22;
|
||||
** Release user level name lock from thread 1. This will cause the ULL
|
||||
** on thread 2 to end its wait.
|
||||
DO release_lock("hello");
|
||||
** Table is now updated with a new eta on tipo=22 for thread 1.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** Release the lock and collect result from update on thread 2
|
||||
DO release_lock("hello");
|
||||
** Table should have eta updates where tipo=11 but updates made by
|
||||
** thread 1 shouldn't be visible yet.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** Sending commit on thread 2.
|
||||
commit;
|
||||
** connection thread1
|
||||
** Make sure table reads didn't change yet on thread 1.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** And send final commit on thread 1.
|
||||
commit;
|
||||
** Table should now be updated by both updates in the order of
|
||||
** thread 1,2.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** Make sure the output is similar for t1.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** two UPDATE's running and one changing result set
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** Get ULL "hello" on thread 1
|
||||
select get_lock("hello",10);
|
||||
get_lock("hello",10)
|
||||
1
|
||||
** connection thread2
|
||||
** Start transaction on thread 2
|
||||
begin;
|
||||
** Update will cause a table scan.
|
||||
** This will cause a hang on the first row where tipo=1 until the
|
||||
** blocking ULL is released.
|
||||
update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
|
||||
** connection thread1
|
||||
** Start transaction on thread 1
|
||||
begin;
|
||||
** Update on t1 will cause a table scan which will be blocked because
|
||||
** the previously initiated table scan applied exclusive key locks on
|
||||
** all primary keys.
|
||||
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
** do not match the WHERE condition are released.
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
** Release ULL. This will release the next waiting ULL on thread 2.
|
||||
DO release_lock("hello");
|
||||
** The table should still be updated with updates for thread 1 only:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 1 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 1 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 1 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** Release the lock and collect result from thread 2:
|
||||
DO release_lock("hello");
|
||||
** Seen from thread 2 the table should have been updated on four
|
||||
** places.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
1 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
1 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
1 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** connection thread1
|
||||
** Thread 2 has committed but the result should remain the same for
|
||||
** thread 1 (updated on three places):
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 1 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 1 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 1 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** After a commit the table should be merged with the previous
|
||||
** commit.
|
||||
** This select should show both updates:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
1 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 1 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
1 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 1 fffffffffffffffffffffffffffffffffffffffffff
|
||||
1 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 1 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
1 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 1 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
1 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 1 fffffffffffffffffffffffffffffffffffffffffff
|
||||
1 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 1 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
1 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 1 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
1 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 1 fffffffffffffffffffffffffffffffffffffffffff
|
||||
1 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 1 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** One UPDATE and one INSERT .... Monty's test
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1 (a int not null, b int not null);
|
||||
insert into t1 values (1,1),(2,1),(3,1),(4,1);
|
||||
** Create ULL 'hello2'
|
||||
select get_lock("hello2",10);
|
||||
get_lock("hello2",10)
|
||||
1
|
||||
** connection thread2
|
||||
** Begin a new transaction on thread 2
|
||||
begin;
|
||||
** Update will create a table scan which creates a ULL where a=2;
|
||||
** this will hang waiting on thread 1.
|
||||
update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2;
|
||||
** connection thread1
|
||||
** Insert new values to t1 from thread 1; this created an implicit
|
||||
** commit since there are no on-going transactions.
|
||||
insert into t1 values (1,1);
|
||||
** Release the ULL (thread 2 updates will finish).
|
||||
DO release_lock("hello2");
|
||||
** ..but thread 1 will still see t1 as if nothing has happend:
|
||||
select * from t1;
|
||||
a b
|
||||
1 1
|
||||
2 1
|
||||
3 1
|
||||
4 1
|
||||
1 1
|
||||
** connection thread2
|
||||
** Collect results from thread 2 and release the lock.
|
||||
DO release_lock("hello2");
|
||||
** The table should look like the original+updates for thread 2,
|
||||
** and consist of new rows:
|
||||
select * from t1;
|
||||
a b
|
||||
1 1
|
||||
2 10
|
||||
3 1
|
||||
4 1
|
||||
1 1
|
||||
** Commit changes from thread 2
|
||||
commit;
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** one UPDATE changing result set and SELECT ... FOR UPDATE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** connection thread2
|
||||
** Begin a new transaction on thread 2
|
||||
begin;
|
||||
** Select a range for update.
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
eta tipo c
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
** connection thread1
|
||||
** Begin a new transaction on thread 1
|
||||
begin;
|
||||
** Update the same range which is marked for update on thread 2; this
|
||||
** will hang because of row locks.
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
** After the update the table will be unmodified because the previous
|
||||
** transaction failed and was rolled back.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** The table should look unmodified from thread 2.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** Sending a commit should release the row locks and enable
|
||||
** thread 1 to complete the transaction.
|
||||
commit;
|
||||
** connection thread1
|
||||
** Commit on thread 1.
|
||||
commit;
|
||||
** connection thread2
|
||||
** The table should not have been changed.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
** Even on thread 1:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** one UPDATE not changing result set and SELECT ... FOR UPDATE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** connection thread2
|
||||
** Starting new transaction on thread 2.
|
||||
begin;
|
||||
** Starting SELECT .. FOR UPDATE
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
eta tipo c
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
** connection thread1
|
||||
|
||||
** Starting new transaction on thread 1
|
||||
begin;
|
||||
** Updating single row using a table scan. This will time out
|
||||
** because of ongoing transaction on thread 1 holding lock on
|
||||
** all primary keys in the scan.
|
||||
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
** do not match the WHERE condition are released.
|
||||
update t1 set tipo=11 where tipo=22;
|
||||
** After the time out the transaction is aborted; no rows should
|
||||
** have changed.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 11 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** The same thing should hold true for the transaction on
|
||||
** thread 2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** connection thread1
|
||||
commit;
|
||||
** connection thread2
|
||||
** Even after committing:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 11 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 11 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** two SELECT ... FOR UPDATE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** connection thread2
|
||||
** Begin a new transaction on thread 2
|
||||
begin;
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
eta tipo c
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
** connection thread1
|
||||
** Begin a new transaction on thread 1
|
||||
begin;
|
||||
** Selecting a range for update by table scan will be blocked
|
||||
** because of on-going transaction on thread 2.
|
||||
select * from t1 where tipo=1 FOR UPDATE;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
** connection thread2
|
||||
** Table will be unchanged and the select command will not be
|
||||
** blocked:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** Commit transacton on thread 2.
|
||||
commit;
|
||||
** connection thread1
|
||||
** Commit transaction on thread 1.
|
||||
commit;
|
||||
** connection thread2
|
||||
** Make sure table isn't blocked on thread 2:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
** Make sure table isn't blocked on thread 1:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** one UPDATE changing result set and DELETE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** connection thread2
|
||||
begin;
|
||||
delete from t1 where tipo=2;
|
||||
** connection thread1
|
||||
begin;
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** connection thread1
|
||||
commit;
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** one UPDATE not changing result set and DELETE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** connection thread2
|
||||
begin;
|
||||
delete from t1 where tipo=2;
|
||||
** connection thread1
|
||||
begin;
|
||||
** Update on t1 will cause a table scan which will be blocked because
|
||||
** the previously initiated table scan applied exclusive key locks on
|
||||
** all primary keys.
|
||||
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
** do not match the WHERE condition are released.
|
||||
update t1 set tipo=1 where tipo=22;
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 1 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** connection thread1
|
||||
commit;
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 1 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 1 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** Cleanup
|
||||
** connection thread2
|
||||
** connection default
|
||||
drop table t1;
|
||||
drop user mysqltest@localhost;
|
||||
231
build/lib/mysql/mysql-test/r/connect.result
Normal file
231
build/lib/mysql/mysql-test/r/connect.result
Normal file
@@ -0,0 +1,231 @@
|
||||
drop table if exists t1,t2;
|
||||
show tables;
|
||||
Tables_in_mysql
|
||||
columns_priv
|
||||
db
|
||||
event
|
||||
func
|
||||
general_log
|
||||
help_category
|
||||
help_keyword
|
||||
help_relation
|
||||
help_topic
|
||||
host
|
||||
ndb_binlog_index
|
||||
plugin
|
||||
proc
|
||||
procs_priv
|
||||
servers
|
||||
slow_log
|
||||
tables_priv
|
||||
time_zone
|
||||
time_zone_leap_second
|
||||
time_zone_name
|
||||
time_zone_transition
|
||||
time_zone_transition_type
|
||||
user
|
||||
show tables;
|
||||
Tables_in_test
|
||||
connect(localhost,root,z,test2,MASTER_PORT,MASTER_SOCKET);
|
||||
ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES)
|
||||
connect(localhost,root,z,test,MASTER_PORT,MASTER_SOCKET);
|
||||
ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES)
|
||||
grant ALL on *.* to test@localhost identified by "gambling";
|
||||
grant ALL on *.* to test@127.0.0.1 identified by "gambling";
|
||||
show tables;
|
||||
Tables_in_mysql
|
||||
columns_priv
|
||||
db
|
||||
event
|
||||
func
|
||||
general_log
|
||||
help_category
|
||||
help_keyword
|
||||
help_relation
|
||||
help_topic
|
||||
host
|
||||
ndb_binlog_index
|
||||
plugin
|
||||
proc
|
||||
procs_priv
|
||||
servers
|
||||
slow_log
|
||||
tables_priv
|
||||
time_zone
|
||||
time_zone_leap_second
|
||||
time_zone_name
|
||||
time_zone_transition
|
||||
time_zone_transition_type
|
||||
user
|
||||
show tables;
|
||||
Tables_in_test
|
||||
connect(localhost,test,,test2,MASTER_PORT,MASTER_SOCKET);
|
||||
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
|
||||
connect(localhost,test,,"",MASTER_PORT,MASTER_SOCKET);
|
||||
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
|
||||
connect(localhost,test,zorro,test2,MASTER_PORT,MASTER_SOCKET);
|
||||
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
|
||||
connect(localhost,test,zorro,test,MASTER_PORT,MASTER_SOCKET);
|
||||
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
|
||||
update mysql.user set password=old_password("gambling2") where user=_binary"test";
|
||||
flush privileges;
|
||||
set password="";
|
||||
set password='gambling3';
|
||||
ERROR HY000: Password hash should be a 41-digit hexadecimal number
|
||||
set password=old_password('gambling3');
|
||||
show tables;
|
||||
Tables_in_mysql
|
||||
columns_priv
|
||||
db
|
||||
event
|
||||
func
|
||||
general_log
|
||||
help_category
|
||||
help_keyword
|
||||
help_relation
|
||||
help_topic
|
||||
host
|
||||
ndb_binlog_index
|
||||
plugin
|
||||
proc
|
||||
procs_priv
|
||||
servers
|
||||
slow_log
|
||||
tables_priv
|
||||
time_zone
|
||||
time_zone_leap_second
|
||||
time_zone_name
|
||||
time_zone_transition
|
||||
time_zone_transition_type
|
||||
user
|
||||
show tables;
|
||||
Tables_in_test
|
||||
connect(localhost,test,,test2,MASTER_PORT,MASTER_SOCKET);
|
||||
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
|
||||
connect(localhost,test,,test,MASTER_PORT,MASTER_SOCKET);
|
||||
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
|
||||
connect(localhost,test,zorro,test2,MASTER_PORT,MASTER_SOCKET);
|
||||
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
|
||||
connect(localhost,test,zorro,test,MASTER_PORT,MASTER_SOCKET);
|
||||
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
|
||||
delete from mysql.user where user=_binary"test";
|
||||
flush privileges;
|
||||
create table t1 (id integer not null auto_increment primary key);
|
||||
create temporary table t2(id integer not null auto_increment primary key);
|
||||
set @id := 1;
|
||||
delete from t1 where id like @id;
|
||||
drop table t1;
|
||||
# ------------------------------------------------------------------
|
||||
# -- End of 4.1 tests
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
# -- Bug#33507: Event scheduler creates more threads than max_connections
|
||||
# -- which results in user lockout.
|
||||
|
||||
GRANT USAGE ON *.* TO mysqltest_u1@localhost;
|
||||
|
||||
SET GLOBAL max_connections = 3;
|
||||
SET GLOBAL event_scheduler = ON;
|
||||
|
||||
# -- Waiting for Event Scheduler to start...
|
||||
|
||||
# -- Disconnecting default connection...
|
||||
|
||||
# -- Check that we allow exactly three user connections, no matter how
|
||||
# -- many threads are running.
|
||||
|
||||
# -- Connecting (1)...
|
||||
# -- Establishing connection 'con_1' (user: mysqltest_u1)...
|
||||
# -- Connection 'con_1' has been established.
|
||||
|
||||
# -- Connecting (2)...
|
||||
# -- Establishing connection 'con_2' (user: mysqltest_u1)...
|
||||
# -- Connection 'con_2' has been established.
|
||||
|
||||
# -- Connecting (3)...
|
||||
# -- Establishing connection 'con_3' (user: mysqltest_u1)...
|
||||
# -- Connection 'con_3' has been established.
|
||||
|
||||
# -- Connecting (4) [should fail]...
|
||||
# -- Establishing connection 'con_4' (user: mysqltest_u1)...
|
||||
# -- Error: can not establish connection 'con_4'.
|
||||
|
||||
# -- Check that we allow one extra SUPER-user connection.
|
||||
|
||||
# -- Connecting super (1)...
|
||||
# -- Establishing connection 'con_super_1' (user: root)...
|
||||
# -- Connection 'con_super_1' has been established.
|
||||
|
||||
# -- Connecting super (2) [should fail]...
|
||||
# -- Establishing connection 'con_super_2' (user: root)...
|
||||
# -- Error: can not establish connection 'con_super_2'.
|
||||
|
||||
# -- Ensure that we have Event Scheduler thread, 3 ordinary user
|
||||
# -- connections and one extra super-user connection.
|
||||
SELECT user FROM information_schema.processlist ORDER BY id;
|
||||
user
|
||||
event_scheduler
|
||||
mysqltest_u1
|
||||
mysqltest_u1
|
||||
mysqltest_u1
|
||||
root
|
||||
|
||||
# -- Resetting variables...
|
||||
SET GLOBAL max_connections = 151;
|
||||
|
||||
# -- Stopping Event Scheduler...
|
||||
SET GLOBAL event_scheduler = OFF;
|
||||
|
||||
# -- Waiting for Event Scheduler to stop...
|
||||
|
||||
# -- That's it. Closing connections...
|
||||
|
||||
# -- Restoring default connection...
|
||||
|
||||
# -- Waiting for connections to close...
|
||||
|
||||
DROP USER mysqltest_u1@localhost;
|
||||
|
||||
# -- End of Bug#33507.
|
||||
|
||||
# -- Bug#35074: max_used_connections is not correct.
|
||||
|
||||
FLUSH STATUS;
|
||||
|
||||
SHOW STATUS LIKE 'max_used_connections';
|
||||
Variable_name Value
|
||||
Max_used_connections 1
|
||||
|
||||
# -- Starting Event Scheduler...
|
||||
SET GLOBAL event_scheduler = ON;
|
||||
# -- Waiting for Event Scheduler to start...
|
||||
|
||||
# -- Opening a new connection to check max_used_connections...
|
||||
|
||||
# -- Check that max_used_connections hasn't changed.
|
||||
SHOW STATUS LIKE 'max_used_connections';
|
||||
Variable_name Value
|
||||
Max_used_connections 2
|
||||
|
||||
# -- Closing new connection...
|
||||
|
||||
# -- Stopping Event Scheduler...
|
||||
SET GLOBAL event_scheduler = OFF;
|
||||
# -- Waiting for Event Scheduler to stop...
|
||||
|
||||
# -- End of Bug#35074.
|
||||
|
||||
#
|
||||
# -- Bug#49752: 2469.126.2 unintentionally breaks authentication
|
||||
# against MySQL 5.1 server
|
||||
#
|
||||
GRANT ALL ON test.* TO 'Azundris12345678'@'localhost' IDENTIFIED BY 'test123';
|
||||
FLUSH PRIVILEGES;
|
||||
DROP USER 'Azundris12345678'@'localhost';
|
||||
FLUSH PRIVILEGES;
|
||||
#
|
||||
# -- End of Bug#49752
|
||||
#
|
||||
# ------------------------------------------------------------------
|
||||
# -- End of 5.1 tests
|
||||
# ------------------------------------------------------------------
|
||||
42
build/lib/mysql/mysql-test/r/consistent_snapshot.result
Normal file
42
build/lib/mysql/mysql-test/r/consistent_snapshot.result
Normal file
@@ -0,0 +1,42 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
# Establish connection con1 (user=root)
|
||||
# Establish connection con2 (user=root)
|
||||
### Test 1:
|
||||
### - While a consistent snapshot transaction is executed,
|
||||
### no external inserts should be visible to the transaction.
|
||||
# Switch to connection con1
|
||||
CREATE TABLE t1 (a INT) ENGINE=innodb;
|
||||
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
||||
# Switch to connection con2
|
||||
INSERT INTO t1 VALUES(1);
|
||||
# Switch to connection con1
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
COMMIT;
|
||||
### Test 2:
|
||||
### - For any non-consistent snapshot transaction, external
|
||||
### committed inserts should be visible to the transaction.
|
||||
DELETE FROM t1;
|
||||
START TRANSACTION;
|
||||
# Switch to connection con2
|
||||
INSERT INTO t1 VALUES(1);
|
||||
# Switch to connection con1
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
1
|
||||
COMMIT;
|
||||
### Test 3:
|
||||
### - Bug#44664: valgrind warning for COMMIT_AND_CHAIN and ROLLBACK_AND_CHAIN
|
||||
### Chaining a transaction does not retain consistency level.
|
||||
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
||||
DELETE FROM t1;
|
||||
COMMIT WORK AND CHAIN;
|
||||
# Switch to connection con2
|
||||
INSERT INTO t1 VALUES(1);
|
||||
# Switch to connection con1
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
1
|
||||
COMMIT;
|
||||
# Switch to connection default + close connections con1 and con2
|
||||
DROP TABLE t1;
|
||||
29
build/lib/mysql/mysql-test/r/constraints.result
Normal file
29
build/lib/mysql/mysql-test/r/constraints.result
Normal file
@@ -0,0 +1,29 @@
|
||||
drop table if exists t1;
|
||||
create table t1 (a int check (a>0));
|
||||
insert into t1 values (1);
|
||||
insert into t1 values (0);
|
||||
drop table t1;
|
||||
create table t1 (a int ,b int, check a>b);
|
||||
insert into t1 values (1,0);
|
||||
insert into t1 values (0,1);
|
||||
drop table t1;
|
||||
create table t1 (a int ,b int, constraint abc check (a>b));
|
||||
insert into t1 values (1,0);
|
||||
insert into t1 values (0,1);
|
||||
drop table t1;
|
||||
create table t1 (a int null);
|
||||
insert into t1 values (1),(NULL);
|
||||
drop table t1;
|
||||
create table t1 (a int null);
|
||||
alter table t1 add constraint constraint_1 unique (a);
|
||||
alter table t1 add constraint unique key_1(a);
|
||||
alter table t1 add constraint constraint_2 unique key_2(a);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL,
|
||||
UNIQUE KEY `constraint_1` (`a`),
|
||||
UNIQUE KEY `key_1` (`a`),
|
||||
UNIQUE KEY `key_2` (`a`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
5
build/lib/mysql/mysql-test/r/contributors.result
Normal file
5
build/lib/mysql/mysql-test/r/contributors.result
Normal file
@@ -0,0 +1,5 @@
|
||||
SHOW CONTRIBUTORS;
|
||||
Name Location Comment
|
||||
Ronald Bradford Brisbane, Australia EFF contribution for UC2006 Auction
|
||||
Sheeri Kritzer Boston, Mass. USA EFF contribution for UC2006 Auction
|
||||
Mark Shuttleworth London, UK. EFF contribution for UC2006 Auction
|
||||
88
build/lib/mysql/mysql-test/r/count_distinct.result
Normal file
88
build/lib/mysql/mysql-test/r/count_distinct.result
Normal file
@@ -0,0 +1,88 @@
|
||||
drop table if exists t1,t2,t3;
|
||||
create table t1 (libname varchar(21) not null, city text, primary key (libname));
|
||||
create table t2 (isbn varchar(21) not null, author text, title text, primary key (isbn));
|
||||
create table t3 (isbn varchar(21) not null, libname varchar(21) not null, quantity int ,primary key (isbn,libname));
|
||||
insert into t2 values ('001','Daffy','A duck''s life');
|
||||
insert into t2 values ('002','Bugs','A rabbit\'s life');
|
||||
insert into t2 values ('003','Cowboy','Life on the range');
|
||||
insert into t2 values ('000','Anonymous','Wanna buy this book?');
|
||||
insert into t2 values ('004','Best Seller','One Heckuva book');
|
||||
insert into t2 values ('005','EveryoneBuys','This very book');
|
||||
insert into t2 values ('006','San Fran','It is a san fran lifestyle');
|
||||
insert into t2 values ('007','BerkAuthor','Cool.Berkley.the.book');
|
||||
insert into t3 values('000','New York Public Libra','1');
|
||||
insert into t3 values('001','New York Public Libra','2');
|
||||
insert into t3 values('002','New York Public Libra','3');
|
||||
insert into t3 values('003','New York Public Libra','4');
|
||||
insert into t3 values('004','New York Public Libra','5');
|
||||
insert into t3 values('005','New York Public Libra','6');
|
||||
insert into t3 values('006','San Fransisco Public','5');
|
||||
insert into t3 values('007','Berkeley Public1','3');
|
||||
insert into t3 values('007','Berkeley Public2','3');
|
||||
insert into t3 values('001','NYC Lib','8');
|
||||
insert into t1 values ('New York Public Libra','New York');
|
||||
insert into t1 values ('San Fransisco Public','San Fran');
|
||||
insert into t1 values ('Berkeley Public1','Berkeley');
|
||||
insert into t1 values ('Berkeley Public2','Berkeley');
|
||||
insert into t1 values ('NYC Lib','New York');
|
||||
select t2.isbn,city,t1.libname,count(t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city,t1.libname;
|
||||
isbn city libname a
|
||||
007 Berkeley Berkeley Public1 1
|
||||
007 Berkeley Berkeley Public2 1
|
||||
000 New York New York Public Libra 6
|
||||
001 New York NYC Lib 1
|
||||
006 San Fran San Fransisco Public 1
|
||||
select t2.isbn,city,t1.libname,count(distinct t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city having count(distinct t1.libname) > 1;
|
||||
isbn city libname a
|
||||
007 Berkeley Berkeley Public1 2
|
||||
000 New York New York Public Libra 2
|
||||
select t2.isbn,city,t1.libname,count(distinct t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city having count(distinct concat(t1.libname,'a')) > 1;
|
||||
isbn city libname a
|
||||
007 Berkeley Berkeley Public1 2
|
||||
000 New York New York Public Libra 2
|
||||
select t2.isbn,city,@bar:=t1.libname,count(distinct t1.libname) as a
|
||||
from t3 left join t1 on t3.libname=t1.libname left join t2
|
||||
on t3.isbn=t2.isbn group by city having count(distinct
|
||||
t1.libname) > 1;
|
||||
isbn city @bar:=t1.libname a
|
||||
007 Berkeley Berkeley Public1 2
|
||||
000 New York New York Public Libra 2
|
||||
SELECT @bar;
|
||||
@bar
|
||||
Berkeley Public2
|
||||
select t2.isbn,city,concat(@bar:=t1.libname),count(distinct t1.libname) as a
|
||||
from t3 left join t1 on t3.libname=t1.libname left join t2
|
||||
on t3.isbn=t2.isbn group by city having count(distinct
|
||||
t1.libname) > 1;
|
||||
isbn city concat(@bar:=t1.libname) a
|
||||
007 Berkeley Berkeley Public1 2
|
||||
000 New York New York Public Libra 2
|
||||
SELECT @bar;
|
||||
@bar
|
||||
Berkeley Public2
|
||||
drop table t1, t2, t3;
|
||||
create table t1 (f1 int);
|
||||
insert into t1 values (1);
|
||||
create table t2 (f1 int,f2 int);
|
||||
select t1.f1,count(distinct t2.f2),count(distinct 1,NULL) from t1 left join t2 on t1.f1=t2.f1 group by t1.f1;
|
||||
f1 count(distinct t2.f2) count(distinct 1,NULL)
|
||||
1 0 0
|
||||
drop table t1,t2;
|
||||
create table t1 (f int);
|
||||
select count(distinct f) from t1;
|
||||
count(distinct f)
|
||||
0
|
||||
drop table t1;
|
||||
create table t1 (a char(3), b char(20), primary key (a, b));
|
||||
insert into t1 values ('ABW', 'Dutch'), ('ABW', 'English');
|
||||
select count(distinct a) from t1 group by b;
|
||||
count(distinct a)
|
||||
1
|
||||
1
|
||||
drop table t1;
|
||||
create table t1 (f1 int, f2 int);
|
||||
insert into t1 values (0,1),(1,2);
|
||||
select count(distinct if(f1,3,f2)) from t1;
|
||||
count(distinct if(f1,3,f2))
|
||||
2
|
||||
drop table t1;
|
||||
129
build/lib/mysql/mysql-test/r/count_distinct2.result
Normal file
129
build/lib/mysql/mysql-test/r/count_distinct2.result
Normal file
@@ -0,0 +1,129 @@
|
||||
drop table if exists t1;
|
||||
create table t1(n1 int, n2 int, s char(20), vs varchar(20), t text);
|
||||
insert into t1 values (1,11, 'one','eleven', 'eleven'),
|
||||
(1,11, 'one','eleven', 'eleven'),
|
||||
(2,11, 'two','eleven', 'eleven'),
|
||||
(2,12, 'two','twevle', 'twelve'),
|
||||
(2,13, 'two','thirteen', 'foo'),
|
||||
(2,13, 'two','thirteen', 'foo'),
|
||||
(2,13, 'two','thirteen', 'bar'),
|
||||
(NULL,13, 'two','thirteen', 'bar'),
|
||||
(2,NULL, 'two','thirteen', 'bar'),
|
||||
(2,13, NULL,'thirteen', 'bar'),
|
||||
(2,13, 'two',NULL, 'bar'),
|
||||
(2,13, 'two','thirteen', NULL);
|
||||
select distinct n1 from t1;
|
||||
n1
|
||||
1
|
||||
2
|
||||
NULL
|
||||
select count(distinct n1) from t1;
|
||||
count(distinct n1)
|
||||
2
|
||||
select distinct n2 from t1;
|
||||
n2
|
||||
11
|
||||
12
|
||||
13
|
||||
NULL
|
||||
select count(distinct n2) from t1;
|
||||
count(distinct n2)
|
||||
3
|
||||
select distinct s from t1;
|
||||
s
|
||||
one
|
||||
two
|
||||
NULL
|
||||
select count(distinct s) from t1;
|
||||
count(distinct s)
|
||||
2
|
||||
select distinct vs from t1;
|
||||
vs
|
||||
eleven
|
||||
twevle
|
||||
thirteen
|
||||
NULL
|
||||
select count(distinct vs) from t1;
|
||||
count(distinct vs)
|
||||
3
|
||||
select distinct t from t1;
|
||||
t
|
||||
eleven
|
||||
twelve
|
||||
foo
|
||||
bar
|
||||
NULL
|
||||
select count(distinct t) from t1;
|
||||
count(distinct t)
|
||||
4
|
||||
select distinct n1,n2 from t1;
|
||||
n1 n2
|
||||
1 11
|
||||
2 11
|
||||
2 12
|
||||
2 13
|
||||
NULL 13
|
||||
2 NULL
|
||||
select count(distinct n1,n2) from t1;
|
||||
count(distinct n1,n2)
|
||||
4
|
||||
select distinct n1,s from t1;
|
||||
n1 s
|
||||
1 one
|
||||
2 two
|
||||
NULL two
|
||||
2 NULL
|
||||
select count(distinct n1,s) from t1;
|
||||
count(distinct n1,s)
|
||||
2
|
||||
select distinct s,n1,vs from t1;
|
||||
s n1 vs
|
||||
one 1 eleven
|
||||
two 2 eleven
|
||||
two 2 twevle
|
||||
two 2 thirteen
|
||||
two NULL thirteen
|
||||
NULL 2 thirteen
|
||||
two 2 NULL
|
||||
select count(distinct s,n1,vs) from t1;
|
||||
count(distinct s,n1,vs)
|
||||
4
|
||||
select distinct s,t from t1;
|
||||
s t
|
||||
one eleven
|
||||
two eleven
|
||||
two twelve
|
||||
two foo
|
||||
two bar
|
||||
NULL bar
|
||||
two NULL
|
||||
select count(distinct s,t) from t1;
|
||||
count(distinct s,t)
|
||||
5
|
||||
select count(distinct n1), count(distinct n2) from t1;
|
||||
count(distinct n1) count(distinct n2)
|
||||
2 3
|
||||
select count(distinct n2), n1 from t1 group by n1;
|
||||
count(distinct n2) n1
|
||||
1 NULL
|
||||
1 1
|
||||
3 2
|
||||
drop table t1;
|
||||
create table t1 (n int default NULL);
|
||||
flush status;
|
||||
select count(distinct n) from t1;
|
||||
count(distinct n)
|
||||
5000
|
||||
show status like 'Created_tmp_disk_tables';
|
||||
Variable_name Value
|
||||
Created_tmp_disk_tables 0
|
||||
drop table t1;
|
||||
create table t1 (s text);
|
||||
flush status;
|
||||
select count(distinct s) from t1;
|
||||
count(distinct s)
|
||||
5000
|
||||
show status like 'Created_tmp_disk_tables';
|
||||
Variable_name Value
|
||||
Created_tmp_disk_tables 1
|
||||
drop table t1;
|
||||
9
build/lib/mysql/mysql-test/r/count_distinct3.result
Normal file
9
build/lib/mysql/mysql-test/r/count_distinct3.result
Normal file
@@ -0,0 +1,9 @@
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
CREATE TABLE t1 (id INTEGER, grp TINYINT, id_rev INTEGER);
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
4201000
|
||||
SELECT COUNT(DISTINCT id) FROM t1 GROUP BY grp;
|
||||
# Begin cleanup
|
||||
SET session myisam_sort_buffer_size = @orig_myisam_sort_buffer_size;
|
||||
DROP TABLE t1;
|
||||
14
build/lib/mysql/mysql-test/r/crash_commit_before.result
Normal file
14
build/lib/mysql/mysql-test/r/crash_commit_before.result
Normal file
@@ -0,0 +1,14 @@
|
||||
CREATE TABLE t1(a int) engine=innodb;
|
||||
START TRANSACTION;
|
||||
insert into t1 values(9);
|
||||
SET SESSION debug="d,crash_commit_before";
|
||||
COMMIT;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
DROP TABLE t1;
|
||||
247
build/lib/mysql/mysql-test/r/create-big.result
Normal file
247
build/lib/mysql/mysql-test/r/create-big.result
Normal file
@@ -0,0 +1,247 @@
|
||||
drop table if exists t1,t2,t3,t4,t5;
|
||||
set session debug="+d,sleep_create_select_before_create";
|
||||
create table t1 select 1 as i;;
|
||||
create table t1 (j char(5));
|
||||
ERROR 42S01: Table 't1' already exists
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`i` int(1) NOT NULL DEFAULT '0'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 select 1 as i;;
|
||||
create table t1 select "Test" as j;
|
||||
ERROR 42S01: Table 't1' already exists
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`i` int(1) NOT NULL DEFAULT '0'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t3 (j char(5));
|
||||
create table t1 select 1 as i;;
|
||||
create table t1 like t3;
|
||||
ERROR 42S01: Table 't1' already exists
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`i` int(1) NOT NULL DEFAULT '0'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 select 1 as i;;
|
||||
rename table t3 to t1;
|
||||
ERROR 42S01: Table 't1' already exists
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`i` int(1) NOT NULL DEFAULT '0'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 select 1 as i;;
|
||||
alter table t3 rename to t1;
|
||||
ERROR 42S01: Table 't1' already exists
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`i` int(1) NOT NULL DEFAULT '0'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 select 1 as i;;
|
||||
alter table t3 rename to t1, add k int;
|
||||
ERROR 42S01: Table 't1' already exists
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`i` int(1) NOT NULL DEFAULT '0'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1, t3;
|
||||
set session debug="-d,sleep_create_select_before_create:+d,sleep_create_select_before_open";
|
||||
create table t1 select 1 as i;;
|
||||
drop table t1;
|
||||
create table t1 select 1 as i;;
|
||||
rename table t1 to t2;
|
||||
drop table t2;
|
||||
create table t1 select 1 as i;;
|
||||
select * from t1;
|
||||
i
|
||||
1
|
||||
drop table t1;
|
||||
create table t1 select 1 as i;;
|
||||
insert into t1 values (2);
|
||||
select * from t1;
|
||||
i
|
||||
1
|
||||
2
|
||||
drop table t1;
|
||||
set @a:=0;
|
||||
create table t1 select 1 as i;;
|
||||
create trigger t1_bi before insert on t1 for each row set @a:=1;
|
||||
select @a;
|
||||
@a
|
||||
0
|
||||
drop table t1;
|
||||
set session debug="-d,sleep_create_select_before_open:+d,sleep_create_select_before_lock";
|
||||
create table t1 select 1 as i;;
|
||||
drop table t1;
|
||||
create table t1 select 1 as i;;
|
||||
rename table t1 to t2;
|
||||
drop table t2;
|
||||
create table t1 select 1 as i;;
|
||||
select * from t1;
|
||||
i
|
||||
1
|
||||
drop table t1;
|
||||
create table t1 select 1 as i;;
|
||||
insert into t1 values (2);
|
||||
select * from t1;
|
||||
i
|
||||
1
|
||||
2
|
||||
drop table t1;
|
||||
set @a:=0;
|
||||
create table t1 select 1 as i;;
|
||||
create trigger t1_bi before insert on t1 for each row set @a:=1;
|
||||
select @a;
|
||||
@a
|
||||
0
|
||||
drop table t1;
|
||||
set session debug="-d,sleep_create_select_before_lock:+d,sleep_create_select_before_check_if_exists";
|
||||
create table t1 (i int);
|
||||
create table if not exists t1 select 1 as i;;
|
||||
drop table t1;
|
||||
Warnings:
|
||||
Note 1050 Table 't1' already exists
|
||||
create table t1 (i int);
|
||||
set @a:=0;
|
||||
create table if not exists t1 select 1 as i;;
|
||||
create trigger t1_bi before insert on t1 for each row set @a:=1;
|
||||
Warnings:
|
||||
Note 1050 Table 't1' already exists
|
||||
select @a;
|
||||
@a
|
||||
0
|
||||
select * from t1;
|
||||
i
|
||||
1
|
||||
drop table t1;
|
||||
set session debug="-d,sleep_create_select_before_check_if_exists";
|
||||
create table t2 (a int);
|
||||
create table t4 (b int);
|
||||
lock table t4 write;
|
||||
select 1;
|
||||
1
|
||||
1
|
||||
create table t3 as select * from t4;;
|
||||
create table t1 select * from t2, t3;;
|
||||
unlock tables;
|
||||
select * from t1;
|
||||
a b
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL,
|
||||
`b` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1, t3;
|
||||
lock table t4 read;
|
||||
select 1;
|
||||
1
|
||||
1
|
||||
rename table t4 to t3;;
|
||||
create table if not exists t1 select 1 as i from t2, t3;;
|
||||
create table t5 (j int);
|
||||
rename table t5 to t1;
|
||||
unlock tables;
|
||||
Warnings:
|
||||
Note 1050 Table 't1' already exists
|
||||
select * from t1;
|
||||
j
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`j` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1, t2, t3;
|
||||
drop table if exists t1,t2;
|
||||
create table t1 (i int);
|
||||
set session debug="+d,sleep_create_like_before_check_if_exists";
|
||||
reset master;
|
||||
create table t2 like t1;;
|
||||
insert into t1 values (1);
|
||||
drop table t1;
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`i` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t2;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; insert into t1 values (1)
|
||||
master-bin.000001 # Query # # use `test`; create table t2 like t1
|
||||
master-bin.000001 # Query # # use `test`; drop table t1
|
||||
master-bin.000001 # Query # # use `test`; drop table t2
|
||||
create table t1 (i int);
|
||||
set session debug="-d,sleep_create_like_before_check_if_exists:+d,sleep_create_like_before_copy";
|
||||
create table t2 like t1;;
|
||||
create table if not exists t2 (j int);
|
||||
Warnings:
|
||||
Note 1050 Table 't2' already exists
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`i` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t2;
|
||||
reset master;
|
||||
create table t2 like t1;;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; create table t2 like t1
|
||||
master-bin.000001 # Query # # use `test`; drop table t1
|
||||
master-bin.000001 # Query # # use `test`; drop table t2
|
||||
create table t1 (i int);
|
||||
set session debug="-d,sleep_create_like_before_copy:+d,sleep_create_like_before_ha_create";
|
||||
reset master;
|
||||
create table t2 like t1;;
|
||||
insert into t2 values (1);
|
||||
drop table t2;
|
||||
create table t2 like t1;;
|
||||
drop table t2;
|
||||
create table t2 like t1;;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; create table t2 like t1
|
||||
master-bin.000001 # Query # # use `test`; insert into t2 values (1)
|
||||
master-bin.000001 # Query # # use `test`; drop table t2
|
||||
master-bin.000001 # Query # # use `test`; create table t2 like t1
|
||||
master-bin.000001 # Query # # use `test`; drop table t2
|
||||
master-bin.000001 # Query # # use `test`; create table t2 like t1
|
||||
master-bin.000001 # Query # # use `test`; drop table t1
|
||||
master-bin.000001 # Query # # use `test`; drop table t2
|
||||
create table t1 (i int);
|
||||
set session debug="-d,sleep_create_like_before_ha_create:+d,sleep_create_like_before_binlogging";
|
||||
reset master;
|
||||
create table t2 like t1;;
|
||||
insert into t2 values (1);
|
||||
drop table t2;
|
||||
create table t2 like t1;;
|
||||
drop table t2;
|
||||
create table t2 like t1;;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; create table t2 like t1
|
||||
master-bin.000001 # Query # # use `test`; insert into t2 values (1)
|
||||
master-bin.000001 # Query # # use `test`; drop table t2
|
||||
master-bin.000001 # Query # # use `test`; create table t2 like t1
|
||||
master-bin.000001 # Query # # use `test`; drop table t2
|
||||
master-bin.000001 # Query # # use `test`; create table t2 like t1
|
||||
master-bin.000001 # Query # # use `test`; drop table t1
|
||||
master-bin.000001 # Query # # use `test`; drop table t2
|
||||
set session debug="-d,sleep_create_like_before_binlogging";
|
||||
1921
build/lib/mysql/mysql-test/r/create.result
Normal file
1921
build/lib/mysql/mysql-test/r/create.result
Normal file
File diff suppressed because it is too large
Load Diff
31
build/lib/mysql/mysql-test/r/create_not_windows.result
Normal file
31
build/lib/mysql/mysql-test/r/create_not_windows.result
Normal file
@@ -0,0 +1,31 @@
|
||||
drop table if exists `about:text`;
|
||||
create table `about:text` (
|
||||
_id int not null auto_increment,
|
||||
`about:text` varchar(255) not null default '',
|
||||
primary key (_id)
|
||||
);
|
||||
show create table `about:text`;
|
||||
Table Create Table
|
||||
about:text CREATE TABLE `about:text` (
|
||||
`_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`about:text` varchar(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table `about:text`;
|
||||
use test;
|
||||
drop table if exists t1;
|
||||
create table t1(a int) engine=myisam;
|
||||
insert into t1 values(1);
|
||||
"We get an error because the table is in the definition cache"
|
||||
create table t1(a int, b int);
|
||||
ERROR 42S01: Table 't1' already exists
|
||||
"Flush the cache and recreate the table anew to be able to drop it"
|
||||
flush tables;
|
||||
show open tables like "t%";
|
||||
Database Table In_use Name_locked
|
||||
create table t1(a int, b int, c int);
|
||||
"Try to select from the table. This should not crash the server"
|
||||
select count(a) from t1;
|
||||
count(a)
|
||||
0
|
||||
drop table t1;
|
||||
20
build/lib/mysql/mysql-test/r/create_select_tmp.result
Normal file
20
build/lib/mysql/mysql-test/r/create_select_tmp.result
Normal file
@@ -0,0 +1,20 @@
|
||||
drop table if exists t1, t2;
|
||||
CREATE TABLE t1 ( a int );
|
||||
INSERT INTO t1 VALUES (1),(2),(1);
|
||||
CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
select * from t2;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
select * from t2;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
select * from t2;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
select * from t2;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
drop table t1;
|
||||
5416
build/lib/mysql/mysql-test/r/csv.result
Normal file
5416
build/lib/mysql/mysql-test/r/csv.result
Normal file
File diff suppressed because it is too large
Load Diff
40
build/lib/mysql/mysql-test/r/csv_alter_table.result
Normal file
40
build/lib/mysql/mysql-test/r/csv_alter_table.result
Normal file
@@ -0,0 +1,40 @@
|
||||
# ===== csv_alter_table.1 =====
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (a int NOT NULL) ENGINE = CSV;
|
||||
ALTER TABLE t1 ADD COLUMN b CHAR(5) NOT NULL;
|
||||
DESC t1;
|
||||
Field Type Null Key Default Extra
|
||||
a int(11) NO NULL
|
||||
b char(5) NO NULL
|
||||
ALTER TABLE t1 DROP COLUMN b;
|
||||
DESC t1;
|
||||
Field Type Null Key Default Extra
|
||||
a int(11) NO NULL
|
||||
ALTER TABLE t1 MODIFY a BIGINT NOT NULL;
|
||||
DESC t1;
|
||||
Field Type Null Key Default Extra
|
||||
a bigint(20) NO NULL
|
||||
ALTER TABLE t1 CHANGE a a INT NOT NULL;
|
||||
DESC t1;
|
||||
Field Type Null Key Default Extra
|
||||
a int(11) NO NULL
|
||||
DROP TABLE t1;
|
||||
# ===== csv_alter_table.2 =====
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (a int NOT NULL) ENGINE = CSV;
|
||||
ALTER TABLE t1 ADD COLUMN b CHAR(5);
|
||||
ERROR 42000: The storage engine for the table doesn't support nullable columns
|
||||
DESC t1;
|
||||
Field Type Null Key Default Extra
|
||||
a int(11) NO NULL
|
||||
ALTER TABLE t1 MODIFY a BIGINT;
|
||||
ERROR 42000: The storage engine for the table doesn't support nullable columns
|
||||
DESC t1;
|
||||
Field Type Null Key Default Extra
|
||||
a int(11) NO NULL
|
||||
ALTER TABLE t1 CHANGE a a INT;
|
||||
ERROR 42000: The storage engine for the table doesn't support nullable columns
|
||||
DESC t1;
|
||||
Field Type Null Key Default Extra
|
||||
a int(11) NO NULL
|
||||
DROP TABLE t1;
|
||||
57
build/lib/mysql/mysql-test/r/csv_not_null.result
Normal file
57
build/lib/mysql/mysql-test/r/csv_not_null.result
Normal file
@@ -0,0 +1,57 @@
|
||||
# ===== csv_not_null.1 =====
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
# === Will fail -- no NOT NULL ===
|
||||
CREATE TABLE t1 (a int) ENGINE = CSV;
|
||||
ERROR 42000: The storage engine for the table doesn't support nullable columns
|
||||
# === Good CREATE ===
|
||||
CREATE TABLE t1 (a int NOT NULL) ENGINE = CSV;
|
||||
# === Will fail -- ALL columns need NOT NULL ==
|
||||
CREATE TABLE t2 (a int NOT NULL, b char(20)) ENGINE = CSV;
|
||||
ERROR 42000: The storage engine for the table doesn't support nullable columns
|
||||
DROP TABLE t1;
|
||||
# ===== csv_not_null.2 =====
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (a int NOT NULL, b blob NOT NULL, c CHAR(20) NOT NULL,
|
||||
d VARCHAR(20) NOT NULL, e enum('foo','bar') NOT NULL,f DATE NOT NULL)
|
||||
ENGINE = CSV;
|
||||
# === should result in default for each datatype ===
|
||||
INSERT INTO t1 VALUES();
|
||||
SELECT * FROM t1;
|
||||
a b c d e f
|
||||
0 foo 0000-00-00
|
||||
INSERT INTO t1 VALUES(default,default,default,default,default,default);
|
||||
SELECT * FROM t1;
|
||||
a b c d e f
|
||||
0 foo 0000-00-00
|
||||
0 foo 0000-00-00
|
||||
INSERT INTO t1 VALUES(0,'abc','def','ghi','bar','1999-12-31');
|
||||
SELECT * FROM t1;
|
||||
a b c d e f
|
||||
0 foo 0000-00-00
|
||||
0 foo 0000-00-00
|
||||
0 abc def ghi bar 1999-12-31
|
||||
# === insert failures ===
|
||||
INSERT INTO t1 VALUES(NULL,'ab','a','b','foo','2007-01-01');
|
||||
ERROR 23000: Column 'a' cannot be null
|
||||
INSERT INTO t1 VALUES(default(a),default(b), default(c), default(d),
|
||||
default(e), default(f));
|
||||
ERROR HY000: Field 'a' doesn't have a default value
|
||||
DROP TABLE t1;
|
||||
# ===== csv_not_null.3 =====
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (a int NOT NULL, b char(10) NOT NULL) ENGINE = CSV;
|
||||
INSERT INTO t1 VALUES();
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
0
|
||||
UPDATE t1 set b = 'new_value' where a = 0;
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
0 new_value
|
||||
UPDATE t1 set b = NULL where b = 'new_value';
|
||||
Warnings:
|
||||
Warning 1048 Column 'b' cannot be null
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
0
|
||||
DROP TABLE t1;
|
||||
177
build/lib/mysql/mysql-test/r/ctype_ascii.result
Normal file
177
build/lib/mysql/mysql-test/r/ctype_ascii.result
Normal file
@@ -0,0 +1,177 @@
|
||||
set names ascii;
|
||||
select 'e'='`';
|
||||
'e'='`'
|
||||
0
|
||||
select 'y'='~';
|
||||
'y'='~'
|
||||
0
|
||||
create table t1 (a char(1) character set ascii);
|
||||
insert into t1 (a) values (' '), ('a'), ('b'), ('c'), ('d'), ('e'), ('f'), ('g'), ('h'), ('i'), ('j'), ('k'), ('l'), ('m'), ('n'), ('o'), ('p'), ('q'), ('r'), ('s'), ('t'), ('u'), ('v'), ('w'), ('x'), ('y'), ('z'), ('A'), ('B'), ('C'), ('D'), ('E'), ('F'), ('G'), ('H'), ('I'), ('J'), ('K'), ('L'), ('M'), ('N'), ('O'), ('P'), ('Q'), ('R'), ('S'), ('T'), ('U'), ('V'), ('W'), ('X'), ('Y'), ('Z'), ('!'), ('@'), ('#'), ('$'), ('%'), ('^'), ('&'), ('*'), ('('), (')'), ('_'), ('+'), ('`'), ('~'), ('1'), ('2'), ('3'), ('4'), ('5'), ('6'), ('7'), ('8'), ('9'), ('0'), ('['), (']'), ('\\'), ('|'), ('}'), ('{'), ('"'), (':'), (''''), (';'), ('/'), ('.'), (','), ('?'), ('>'), ('<'), ('\n'), ('\t'), ('\a'), ('\f'), ('\v');
|
||||
select t1a.a, t1b.a from t1 as t1a, t1 as t1b where t1a.a=t1b.a order by binary t1a.a, binary t1b.a;
|
||||
a a
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
! !
|
||||
" "
|
||||
# #
|
||||
$ $
|
||||
% %
|
||||
& &
|
||||
' '
|
||||
( (
|
||||
) )
|
||||
* *
|
||||
+ +
|
||||
, ,
|
||||
. .
|
||||
/ /
|
||||
0 0
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
4 4
|
||||
5 5
|
||||
6 6
|
||||
7 7
|
||||
8 8
|
||||
9 9
|
||||
: :
|
||||
; ;
|
||||
< <
|
||||
> >
|
||||
? ?
|
||||
@ @
|
||||
A A
|
||||
A a
|
||||
A a
|
||||
B B
|
||||
B b
|
||||
C C
|
||||
C c
|
||||
D D
|
||||
D d
|
||||
E E
|
||||
E e
|
||||
F F
|
||||
F f
|
||||
F f
|
||||
G G
|
||||
G g
|
||||
H H
|
||||
H h
|
||||
I I
|
||||
I i
|
||||
J J
|
||||
J j
|
||||
K K
|
||||
K k
|
||||
L L
|
||||
L l
|
||||
M M
|
||||
M m
|
||||
N N
|
||||
N n
|
||||
O O
|
||||
O o
|
||||
P P
|
||||
P p
|
||||
Q Q
|
||||
Q q
|
||||
R R
|
||||
R r
|
||||
S S
|
||||
S s
|
||||
T T
|
||||
T t
|
||||
U U
|
||||
U u
|
||||
V V
|
||||
V v
|
||||
V v
|
||||
W W
|
||||
W w
|
||||
X X
|
||||
X x
|
||||
Y Y
|
||||
Y y
|
||||
Z Z
|
||||
Z z
|
||||
[ [
|
||||
\ \
|
||||
] ]
|
||||
^ ^
|
||||
_ _
|
||||
` `
|
||||
a A
|
||||
a A
|
||||
a a
|
||||
a a
|
||||
a a
|
||||
a a
|
||||
b B
|
||||
b b
|
||||
c C
|
||||
c c
|
||||
d D
|
||||
d d
|
||||
e E
|
||||
e e
|
||||
f F
|
||||
f F
|
||||
f f
|
||||
f f
|
||||
f f
|
||||
f f
|
||||
g G
|
||||
g g
|
||||
h H
|
||||
h h
|
||||
i I
|
||||
i i
|
||||
j J
|
||||
j j
|
||||
k K
|
||||
k k
|
||||
l L
|
||||
l l
|
||||
m M
|
||||
m m
|
||||
n N
|
||||
n n
|
||||
o O
|
||||
o o
|
||||
p P
|
||||
p p
|
||||
q Q
|
||||
q q
|
||||
r R
|
||||
r r
|
||||
s S
|
||||
s s
|
||||
t T
|
||||
t t
|
||||
u U
|
||||
u u
|
||||
v V
|
||||
v V
|
||||
v v
|
||||
v v
|
||||
v v
|
||||
v v
|
||||
w W
|
||||
w w
|
||||
x X
|
||||
x x
|
||||
y Y
|
||||
y y
|
||||
z Z
|
||||
z z
|
||||
{ {
|
||||
| |
|
||||
} }
|
||||
~ ~
|
||||
drop table t1;
|
||||
End of 5.0 tests.
|
||||
279
build/lib/mysql/mysql-test/r/ctype_big5.result
Normal file
279
build/lib/mysql/mysql-test/r/ctype_big5.result
Normal file
@@ -0,0 +1,279 @@
|
||||
drop table if exists t1;
|
||||
SET @test_character_set= 'big5';
|
||||
SET @test_collation= 'big5_chinese_ci';
|
||||
SET @safe_character_set_server= @@character_set_server;
|
||||
SET @safe_collation_server= @@collation_server;
|
||||
SET @safe_character_set_client= @@character_set_client;
|
||||
SET @safe_character_set_results= @@character_set_results;
|
||||
SET character_set_server= @test_character_set;
|
||||
SET collation_server= @test_collation;
|
||||
CREATE DATABASE d1;
|
||||
USE d1;
|
||||
CREATE TABLE t1 (c CHAR(10), KEY(c));
|
||||
SHOW FULL COLUMNS FROM t1;
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
c char(10) big5_chinese_ci YES MUL NULL
|
||||
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
|
||||
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
|
||||
want3results
|
||||
aaa
|
||||
aaaa
|
||||
aaaaa
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
|
||||
SHOW FULL COLUMNS FROM t1;
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
c1 varchar(15) big5_chinese_ci YES MUL NULL
|
||||
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
|
||||
SELECT c1 as want3results from t1 where c1 like 'l%';
|
||||
want3results
|
||||
location
|
||||
loberge
|
||||
lotre
|
||||
SELECT c1 as want3results from t1 where c1 like 'lo%';
|
||||
want3results
|
||||
location
|
||||
loberge
|
||||
lotre
|
||||
SELECT c1 as want1result from t1 where c1 like 'loc%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'loca%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locat%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locati%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locatio%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'location%';
|
||||
want1result
|
||||
location
|
||||
DROP TABLE t1;
|
||||
create table t1 (a set('a') not null);
|
||||
insert into t1 values (),();
|
||||
Warnings:
|
||||
Warning 1364 Field 'a' doesn't have a default value
|
||||
select cast(a as char(1)) from t1;
|
||||
cast(a as char(1))
|
||||
|
||||
|
||||
select a sounds like a from t1;
|
||||
a sounds like a
|
||||
1
|
||||
1
|
||||
select 1 from t1 order by cast(a as char(1));
|
||||
1
|
||||
1
|
||||
1
|
||||
drop table t1;
|
||||
set names utf8;
|
||||
create table t1 (
|
||||
name varchar(10),
|
||||
level smallint unsigned);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`name` varchar(10) DEFAULT NULL,
|
||||
`level` smallint(5) unsigned DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=big5
|
||||
insert into t1 values ('string',1);
|
||||
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
|
||||
concat(name,space(level)) concat(name, repeat(' ',level))
|
||||
string string
|
||||
drop table t1;
|
||||
DROP DATABASE d1;
|
||||
USE test;
|
||||
SET character_set_server= @safe_character_set_server;
|
||||
SET collation_server= @safe_collation_server;
|
||||
SET character_set_client= @safe_character_set_client;
|
||||
SET character_set_results= @safe_character_set_results;
|
||||
SET NAMES big5;
|
||||
SET collation_connection='big5_chinese_ci';
|
||||
create table t1 select repeat('a',4000) a;
|
||||
delete from t1;
|
||||
insert into t1 values ('a'), ('a '), ('a\t');
|
||||
select collation(a),hex(a) from t1 order by a;
|
||||
collation(a) hex(a)
|
||||
big5_chinese_ci 6109
|
||||
big5_chinese_ci 61
|
||||
big5_chinese_ci 6120
|
||||
drop table t1;
|
||||
create table t1 engine=innodb select repeat('a',50) as c1;
|
||||
alter table t1 add index(c1(5));
|
||||
insert into t1 values ('abcdefg'),('abcde100'),('abcde110'),('abcde111');
|
||||
select collation(c1) from t1 limit 1;
|
||||
collation(c1)
|
||||
big5_chinese_ci
|
||||
select c1 from t1 where c1 like 'abcdef%' order by c1;
|
||||
c1
|
||||
abcdefg
|
||||
select c1 from t1 where c1 like 'abcde1%' order by c1;
|
||||
c1
|
||||
abcde100
|
||||
abcde110
|
||||
abcde111
|
||||
select c1 from t1 where c1 like 'abcde11%' order by c1;
|
||||
c1
|
||||
abcde110
|
||||
abcde111
|
||||
select c1 from t1 where c1 like 'abcde111%' order by c1;
|
||||
c1
|
||||
abcde111
|
||||
drop table t1;
|
||||
select @@collation_connection;
|
||||
@@collation_connection
|
||||
big5_chinese_ci
|
||||
create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
|
||||
insert into t1 values('abcdef');
|
||||
insert into t1 values('_bcdef');
|
||||
insert into t1 values('a_cdef');
|
||||
insert into t1 values('ab_def');
|
||||
insert into t1 values('abc_ef');
|
||||
insert into t1 values('abcd_f');
|
||||
insert into t1 values('abcde_');
|
||||
select c1 as c1u from t1 where c1 like 'ab\_def';
|
||||
c1u
|
||||
ab_def
|
||||
select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
|
||||
c2h
|
||||
ab_def
|
||||
drop table t1;
|
||||
CREATE TABLE t1 AS
|
||||
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
|
||||
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
|
||||
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
|
||||
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
|
||||
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
|
||||
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
|
||||
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
|
||||
hex(concat(repeat(0xF1F2, 10), '%'))
|
||||
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
|
||||
3 rows expected
|
||||
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
|
||||
a hex(b) c
|
||||
2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
||||
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
||||
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
||||
DROP TABLE t1;
|
||||
SET collation_connection='big5_bin';
|
||||
create table t1 select repeat('a',4000) a;
|
||||
delete from t1;
|
||||
insert into t1 values ('a'), ('a '), ('a\t');
|
||||
select collation(a),hex(a) from t1 order by a;
|
||||
collation(a) hex(a)
|
||||
big5_bin 6109
|
||||
big5_bin 61
|
||||
big5_bin 6120
|
||||
drop table t1;
|
||||
create table t1 engine=innodb select repeat('a',50) as c1;
|
||||
alter table t1 add index(c1(5));
|
||||
insert into t1 values ('abcdefg'),('abcde100'),('abcde110'),('abcde111');
|
||||
select collation(c1) from t1 limit 1;
|
||||
collation(c1)
|
||||
big5_bin
|
||||
select c1 from t1 where c1 like 'abcdef%' order by c1;
|
||||
c1
|
||||
abcdefg
|
||||
select c1 from t1 where c1 like 'abcde1%' order by c1;
|
||||
c1
|
||||
abcde100
|
||||
abcde110
|
||||
abcde111
|
||||
select c1 from t1 where c1 like 'abcde11%' order by c1;
|
||||
c1
|
||||
abcde110
|
||||
abcde111
|
||||
select c1 from t1 where c1 like 'abcde111%' order by c1;
|
||||
c1
|
||||
abcde111
|
||||
drop table t1;
|
||||
select @@collation_connection;
|
||||
@@collation_connection
|
||||
big5_bin
|
||||
create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
|
||||
insert into t1 values('abcdef');
|
||||
insert into t1 values('_bcdef');
|
||||
insert into t1 values('a_cdef');
|
||||
insert into t1 values('ab_def');
|
||||
insert into t1 values('abc_ef');
|
||||
insert into t1 values('abcd_f');
|
||||
insert into t1 values('abcde_');
|
||||
select c1 as c1u from t1 where c1 like 'ab\_def';
|
||||
c1u
|
||||
ab_def
|
||||
select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
|
||||
c2h
|
||||
ab_def
|
||||
drop table t1;
|
||||
CREATE TABLE t1 AS
|
||||
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
|
||||
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
|
||||
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
|
||||
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
|
||||
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
|
||||
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
|
||||
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
|
||||
hex(concat(repeat(0xF1F2, 10), '%'))
|
||||
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
|
||||
3 rows expected
|
||||
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
|
||||
a hex(b) c
|
||||
2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
||||
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
||||
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
||||
DROP TABLE t1;
|
||||
SET NAMES big5;
|
||||
CREATE TABLE t1 (a text) character set big5;
|
||||
INSERT INTO t1 VALUES ('ùØ');
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
ùØ
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a CHAR(50) CHARACTER SET big5 NOT NULL, FULLTEXT(a));
|
||||
INSERT INTO t1 VALUES(0xA741ADCCA66EB6DC20A7DAADCCABDCA66E);
|
||||
SELECT HEX(a) FROM t1 WHERE MATCH(a) AGAINST (0xA741ADCCA66EB6DC IN BOOLEAN MODE);
|
||||
HEX(a)
|
||||
A741ADCCA66EB6DC20A7DAADCCABDCA66E
|
||||
DROP TABLE t1;
|
||||
set names big5;
|
||||
create table t1 (a char character set big5);
|
||||
insert into t1 values (0xF9D6),(0xF9D7),(0xF9D8),(0xF9D9);
|
||||
insert into t1 values (0xF9DA),(0xF9DB),(0xF9DC);
|
||||
select hex(a) a, hex(@u:=convert(a using utf8)) b,
|
||||
hex(convert(@u using big5)) c from t1 order by a;
|
||||
a b c
|
||||
F9D6 E7A281 F9D6
|
||||
F9D7 E98AB9 F9D7
|
||||
F9D8 E8A38F F9D8
|
||||
F9D9 E5A2BB F9D9
|
||||
F9DA E68192 F9DA
|
||||
F9DB E7B2A7 F9DB
|
||||
F9DC E5ABBA F9DC
|
||||
alter table t1 convert to character set utf8;
|
||||
select hex(a) from t1 where a = _big5 0xF9DC;
|
||||
hex(a)
|
||||
E5ABBA
|
||||
drop table t1;
|
||||
select hex(convert(_big5 0xC84041 using ucs2));
|
||||
hex(convert(_big5 0xC84041 using ucs2))
|
||||
003F0041
|
||||
End of 4.1 tests
|
||||
set names big5;
|
||||
create table t1 (a blob);
|
||||
insert into t1 values (0xEE00);
|
||||
select * into outfile 'test/t1.txt' from t1;
|
||||
delete from t1;
|
||||
select hex(load_file('MYSQLD_DATADIR/test/t1.txt'));;
|
||||
hex(load_file('MYSQLD_DATADIR/test/t1.txt'))
|
||||
5CEE5C300A
|
||||
load data infile 't1.txt' into table t1;
|
||||
select hex(a) from t1;
|
||||
hex(a)
|
||||
EE00
|
||||
drop table t1;
|
||||
End of 5.0 tests
|
||||
632
build/lib/mysql/mysql-test/r/ctype_collate.result
Normal file
632
build/lib/mysql/mysql-test/r/ctype_collate.result
Normal file
@@ -0,0 +1,632 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
CREATE TABLE t1 (
|
||||
latin1_f CHAR(32) CHARACTER SET latin1 NOT NULL
|
||||
);
|
||||
CREATE TABLE t2 (
|
||||
latin1_f CHAR(32) CHARACTER SET latin1 COLLATE koi8r_general_ci NOT NULL
|
||||
);
|
||||
ERROR 42000: COLLATION 'koi8r_general_ci' is not valid for CHARACTER SET 'latin1'
|
||||
CREATE TABLE t2 (
|
||||
latin1_f CHAR(32) CHARACTER SET latin1 COLLATE some_non_existing_col NOT NULL
|
||||
);
|
||||
ERROR HY000: Unknown collation: 'some_non_existing_col'
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'A');
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'a');
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'AD');
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'ad');
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'AE');
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'ae');
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'AF');
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'af');
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'Ä');
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'ä');
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'Å');
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'å');
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'B');
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'b');
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'U');
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'u');
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'UE');
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'ue');
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'Ü');
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'ü');
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'SS');
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'ss');
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'ß');
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'Y');
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'y');
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'Z');
|
||||
INSERT INTO t1 (latin1_f) VALUES (_latin1'z');
|
||||
SELECT latin1_f FROM t1 ORDER BY latin1_f;
|
||||
latin1_f
|
||||
A
|
||||
a
|
||||
AD
|
||||
ad
|
||||
ae
|
||||
AE
|
||||
AF
|
||||
af
|
||||
b
|
||||
B
|
||||
SS
|
||||
ss
|
||||
u
|
||||
U
|
||||
UE
|
||||
ue
|
||||
Y
|
||||
y
|
||||
ü
|
||||
Ü
|
||||
Z
|
||||
z
|
||||
å
|
||||
Å
|
||||
Ä
|
||||
ä
|
||||
ß
|
||||
SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE latin1_swedish_ci;
|
||||
latin1_f
|
||||
A
|
||||
a
|
||||
AD
|
||||
ad
|
||||
ae
|
||||
AE
|
||||
AF
|
||||
af
|
||||
b
|
||||
B
|
||||
SS
|
||||
ss
|
||||
u
|
||||
U
|
||||
UE
|
||||
ue
|
||||
Y
|
||||
y
|
||||
ü
|
||||
Ü
|
||||
Z
|
||||
z
|
||||
å
|
||||
Å
|
||||
Ä
|
||||
ä
|
||||
ß
|
||||
SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE latin1_german2_ci;
|
||||
latin1_f
|
||||
A
|
||||
a
|
||||
Å
|
||||
å
|
||||
AD
|
||||
ad
|
||||
Ä
|
||||
ae
|
||||
AE
|
||||
ä
|
||||
af
|
||||
AF
|
||||
b
|
||||
B
|
||||
ß
|
||||
ss
|
||||
SS
|
||||
U
|
||||
u
|
||||
ue
|
||||
UE
|
||||
ü
|
||||
Ü
|
||||
Y
|
||||
y
|
||||
Z
|
||||
z
|
||||
SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE latin1_general_ci;
|
||||
latin1_f
|
||||
A
|
||||
a
|
||||
AD
|
||||
ad
|
||||
AE
|
||||
ae
|
||||
af
|
||||
AF
|
||||
Ä
|
||||
ä
|
||||
Å
|
||||
å
|
||||
b
|
||||
B
|
||||
ss
|
||||
SS
|
||||
ß
|
||||
U
|
||||
u
|
||||
UE
|
||||
ue
|
||||
ü
|
||||
Ü
|
||||
Y
|
||||
y
|
||||
Z
|
||||
z
|
||||
SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE latin1_bin;
|
||||
latin1_f
|
||||
A
|
||||
AD
|
||||
AE
|
||||
AF
|
||||
B
|
||||
SS
|
||||
U
|
||||
UE
|
||||
Y
|
||||
Z
|
||||
a
|
||||
ad
|
||||
ae
|
||||
af
|
||||
b
|
||||
ss
|
||||
u
|
||||
ue
|
||||
y
|
||||
z
|
||||
Ä
|
||||
Å
|
||||
Ü
|
||||
ß
|
||||
ä
|
||||
å
|
||||
ü
|
||||
SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE koi8r_general_ci;
|
||||
ERROR 42000: COLLATION 'koi8r_general_ci' is not valid for CHARACTER SET 'latin1'
|
||||
SELECT latin1_f COLLATE latin1_swedish_ci AS latin1_f_as FROM t1 ORDER BY latin1_f_as;
|
||||
latin1_f_as
|
||||
A
|
||||
a
|
||||
AD
|
||||
ad
|
||||
ae
|
||||
AE
|
||||
AF
|
||||
af
|
||||
b
|
||||
B
|
||||
SS
|
||||
ss
|
||||
u
|
||||
U
|
||||
UE
|
||||
ue
|
||||
Y
|
||||
y
|
||||
ü
|
||||
Ü
|
||||
Z
|
||||
z
|
||||
å
|
||||
Å
|
||||
Ä
|
||||
ä
|
||||
ß
|
||||
SELECT latin1_f COLLATE latin1_german2_ci AS latin1_f_as FROM t1 ORDER BY latin1_f_as;
|
||||
latin1_f_as
|
||||
A
|
||||
a
|
||||
Å
|
||||
å
|
||||
AD
|
||||
ad
|
||||
Ä
|
||||
ae
|
||||
AE
|
||||
ä
|
||||
af
|
||||
AF
|
||||
b
|
||||
B
|
||||
ß
|
||||
ss
|
||||
SS
|
||||
U
|
||||
u
|
||||
ue
|
||||
UE
|
||||
ü
|
||||
Ü
|
||||
Y
|
||||
y
|
||||
Z
|
||||
z
|
||||
SELECT latin1_f COLLATE latin1_general_ci AS latin1_f_as FROM t1 ORDER BY latin1_f_as;
|
||||
latin1_f_as
|
||||
A
|
||||
a
|
||||
AD
|
||||
ad
|
||||
AE
|
||||
ae
|
||||
af
|
||||
AF
|
||||
Ä
|
||||
ä
|
||||
Å
|
||||
å
|
||||
b
|
||||
B
|
||||
ss
|
||||
SS
|
||||
ß
|
||||
U
|
||||
u
|
||||
UE
|
||||
ue
|
||||
ü
|
||||
Ü
|
||||
Y
|
||||
y
|
||||
Z
|
||||
z
|
||||
SELECT latin1_f COLLATE latin1_bin AS latin1_f_as FROM t1 ORDER BY latin1_f_as;
|
||||
latin1_f_as
|
||||
A
|
||||
AD
|
||||
AE
|
||||
AF
|
||||
B
|
||||
SS
|
||||
U
|
||||
UE
|
||||
Y
|
||||
Z
|
||||
a
|
||||
ad
|
||||
ae
|
||||
af
|
||||
b
|
||||
ss
|
||||
u
|
||||
ue
|
||||
y
|
||||
z
|
||||
Ä
|
||||
Å
|
||||
Ü
|
||||
ß
|
||||
ä
|
||||
å
|
||||
ü
|
||||
SELECT latin1_f COLLATE koi8r_general_ci AS latin1_f_as FROM t1 ORDER BY latin1_f_as;
|
||||
ERROR 42000: COLLATION 'koi8r_general_ci' is not valid for CHARACTER SET 'latin1'
|
||||
SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f;
|
||||
latin1_f count(*)
|
||||
A 2
|
||||
AD 2
|
||||
AE 2
|
||||
AF 2
|
||||
B 2
|
||||
SS 2
|
||||
U 2
|
||||
UE 2
|
||||
Ü 4
|
||||
Z 2
|
||||
Å 2
|
||||
Ä 2
|
||||
ß 1
|
||||
SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE latin1_swedish_ci;
|
||||
latin1_f count(*)
|
||||
A 2
|
||||
AD 2
|
||||
AE 2
|
||||
AF 2
|
||||
B 2
|
||||
SS 2
|
||||
U 2
|
||||
UE 2
|
||||
Ü 4
|
||||
Z 2
|
||||
Å 2
|
||||
Ä 2
|
||||
ß 1
|
||||
SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE latin1_german2_ci;
|
||||
latin1_f count(*)
|
||||
A 4
|
||||
AD 2
|
||||
AE 4
|
||||
AF 2
|
||||
B 2
|
||||
SS 3
|
||||
U 2
|
||||
UE 4
|
||||
Y 2
|
||||
Z 2
|
||||
SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE latin1_general_ci;
|
||||
latin1_f count(*)
|
||||
A 2
|
||||
AD 2
|
||||
AE 2
|
||||
AF 2
|
||||
Ä 2
|
||||
Å 2
|
||||
B 2
|
||||
SS 2
|
||||
ß 1
|
||||
U 2
|
||||
UE 2
|
||||
Ü 2
|
||||
Y 2
|
||||
Z 2
|
||||
SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE latin1_bin;
|
||||
latin1_f count(*)
|
||||
A 1
|
||||
AD 1
|
||||
AE 1
|
||||
AF 1
|
||||
B 1
|
||||
SS 1
|
||||
U 1
|
||||
UE 1
|
||||
Y 1
|
||||
Z 1
|
||||
a 1
|
||||
ad 1
|
||||
ae 1
|
||||
af 1
|
||||
b 1
|
||||
ss 1
|
||||
u 1
|
||||
ue 1
|
||||
y 1
|
||||
z 1
|
||||
Ä 1
|
||||
Å 1
|
||||
Ü 1
|
||||
ß 1
|
||||
ä 1
|
||||
å 1
|
||||
ü 1
|
||||
SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE koi8r_general_ci;
|
||||
ERROR 42000: COLLATION 'koi8r_general_ci' is not valid for CHARACTER SET 'latin1'
|
||||
SELECT DISTINCT latin1_f FROM t1;
|
||||
latin1_f
|
||||
A
|
||||
AD
|
||||
AE
|
||||
AF
|
||||
Ä
|
||||
Å
|
||||
B
|
||||
U
|
||||
UE
|
||||
Ü
|
||||
SS
|
||||
ß
|
||||
Z
|
||||
SELECT DISTINCT latin1_f COLLATE latin1_swedish_ci FROM t1;
|
||||
latin1_f COLLATE latin1_swedish_ci
|
||||
A
|
||||
AD
|
||||
AE
|
||||
AF
|
||||
Ä
|
||||
Å
|
||||
B
|
||||
U
|
||||
UE
|
||||
Ü
|
||||
SS
|
||||
ß
|
||||
Z
|
||||
SELECT DISTINCT latin1_f COLLATE latin1_german2_ci FROM t1;
|
||||
latin1_f COLLATE latin1_german2_ci
|
||||
A
|
||||
AD
|
||||
AE
|
||||
AF
|
||||
B
|
||||
U
|
||||
UE
|
||||
SS
|
||||
Y
|
||||
Z
|
||||
SELECT DISTINCT latin1_f COLLATE latin1_general_ci FROM t1;
|
||||
latin1_f COLLATE latin1_general_ci
|
||||
A
|
||||
AD
|
||||
AE
|
||||
AF
|
||||
Ä
|
||||
Å
|
||||
B
|
||||
U
|
||||
UE
|
||||
Ü
|
||||
SS
|
||||
ß
|
||||
Y
|
||||
Z
|
||||
SELECT DISTINCT latin1_f COLLATE latin1_bin FROM t1;
|
||||
latin1_f COLLATE latin1_bin
|
||||
A
|
||||
a
|
||||
AD
|
||||
ad
|
||||
AE
|
||||
ae
|
||||
AF
|
||||
af
|
||||
Ä
|
||||
ä
|
||||
Å
|
||||
å
|
||||
B
|
||||
b
|
||||
U
|
||||
u
|
||||
UE
|
||||
ue
|
||||
Ü
|
||||
ü
|
||||
SS
|
||||
ss
|
||||
ß
|
||||
Y
|
||||
y
|
||||
Z
|
||||
z
|
||||
SELECT DISTINCT latin1_f COLLATE koi8r FROM t1;
|
||||
ERROR HY000: Unknown collation: 'koi8r'
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`latin1_f` char(32) NOT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SHOW FIELDS FROM t1;
|
||||
Field Type Null Key Default Extra
|
||||
latin1_f char(32) NO NULL
|
||||
ALTER TABLE t1 CHANGE latin1_f
|
||||
latin1_f CHAR(32) CHARACTER SET latin1 COLLATE latin1_bin;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`latin1_f` char(32) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SHOW FIELDS FROM t1;
|
||||
Field Type Null Key Default Extra
|
||||
latin1_f char(32) YES NULL
|
||||
ALTER TABLE t1 CHARACTER SET latin1 COLLATE latin1_bin;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`latin1_f` char(32) COLLATE latin1_bin DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin
|
||||
SHOW FIELDS FROM t1;
|
||||
Field Type Null Key Default Extra
|
||||
latin1_f char(32) YES NULL
|
||||
SET CHARACTER SET 'latin1';
|
||||
SHOW VARIABLES LIKE 'character_set_client';
|
||||
Variable_name Value
|
||||
character_set_client latin1
|
||||
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
|
||||
charset('a') collation('a') coercibility('a') 'a'='A'
|
||||
latin1 latin1_swedish_ci 4 1
|
||||
explain extended SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select charset('a') AS `charset('a')`,collation('a') AS `collation('a')`,coercibility('a') AS `coercibility('a')`,('a' = 'A') AS `'a'='A'`
|
||||
SET CHARACTER SET koi8r;
|
||||
SHOW VARIABLES LIKE 'collation_client';
|
||||
Variable_name Value
|
||||
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
|
||||
charset('a') collation('a') coercibility('a') 'a'='A'
|
||||
latin1 latin1_swedish_ci 4 1
|
||||
SET CHARACTER SET 'DEFAULT';
|
||||
ERROR 42000: Unknown character set: 'DEFAULT'
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1
|
||||
(s1 CHAR(5) COLLATE latin1_german1_ci,
|
||||
s2 CHAR(5) COLLATE latin1_swedish_ci);
|
||||
SELECT * FROM t1 WHERE s1 = s2;
|
||||
ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '='
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1
|
||||
(s1 CHAR(5) COLLATE latin1_german1_ci,
|
||||
s2 CHAR(5) COLLATE latin1_swedish_ci,
|
||||
s3 CHAR(5) COLLATE latin1_bin);
|
||||
INSERT INTO t1 VALUES ('a','A','A');
|
||||
SELECT * FROM t1 WHERE s1 = s2;
|
||||
ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '='
|
||||
SELECT * FROM t1 WHERE s1 = s3;
|
||||
s1 s2 s3
|
||||
SELECT * FROM t1 WHERE s2 = s3;
|
||||
s1 s2 s3
|
||||
a A A
|
||||
DROP TABLE t1;
|
||||
SET NAMES latin1;
|
||||
CREATE TABLE t1
|
||||
(s1 char(10) COLLATE latin1_german1_ci,
|
||||
s2 char(10) COLLATE latin1_swedish_ci,
|
||||
KEY(s1),
|
||||
KEY(s2));
|
||||
INSERT INTO t1 VALUES ('a','a');
|
||||
INSERT INTO t1 VALUES ('b','b');
|
||||
INSERT INTO t1 VALUES ('c','c');
|
||||
INSERT INTO t1 VALUES ('d','d');
|
||||
INSERT INTO t1 VALUES ('e','e');
|
||||
INSERT INTO t1 VALUES ('f','f');
|
||||
INSERT INTO t1 VALUES ('g','g');
|
||||
INSERT INTO t1 VALUES ('h','h');
|
||||
INSERT INTO t1 VALUES ('i','i');
|
||||
INSERT INTO t1 VALUES ('j','j');
|
||||
EXPLAIN SELECT * FROM t1 WHERE s1='a';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref s1 s1 11 const 1 Using where
|
||||
EXPLAIN SELECT * FROM t1 WHERE s2='a';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref s2 s2 11 const 1 Using where
|
||||
EXPLAIN SELECT * FROM t1 WHERE s1='a' COLLATE latin1_german1_ci;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref s1 s1 11 const 1 Using where
|
||||
EXPLAIN SELECT * FROM t1 WHERE s2='a' COLLATE latin1_german1_ci;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
|
||||
EXPLAIN SELECT * FROM t1 WHERE s1 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range s1 s1 11 NULL 2 Using where
|
||||
EXPLAIN SELECT * FROM t1 WHERE s2 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
|
||||
EXPLAIN SELECT * FROM t1 WHERE s1 IN ('a','b' COLLATE latin1_german1_ci);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range s1 s1 11 NULL 2 Using where
|
||||
EXPLAIN SELECT * FROM t1 WHERE s2 IN ('a','b' COLLATE latin1_german1_ci);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
|
||||
EXPLAIN SELECT * FROM t1 WHERE s1 LIKE 'a' COLLATE latin1_german1_ci;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range s1 s1 11 NULL 1 Using where
|
||||
EXPLAIN SELECT * FROM t1 WHERE s2 LIKE 'a' COLLATE latin1_german1_ci;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
|
||||
DROP TABLE t1;
|
||||
create table t1(f1 varchar(10) character set latin2 collate latin2_hungarian_ci, key(f1));
|
||||
insert into t1 set f1=0x3F3F9DC73F;
|
||||
insert into t1 set f1=0x3F3F1E563F;
|
||||
insert into t1 set f1=0x3F3F;
|
||||
check table t1 extended;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
drop table t1;
|
||||
create table t1 (a varchar(2) character set latin7 collate latin7_general_ci,key(a));
|
||||
insert into t1 set a=0x4c20;
|
||||
insert into t1 set a=0x6c;
|
||||
insert into t1 set a=0x4c98;
|
||||
check table t1 extended;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
drop table t1;
|
||||
select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci);
|
||||
least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci)
|
||||
a
|
||||
create table t1
|
||||
select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) as f1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` varchar(1) CHARACTER SET latin5 NOT NULL DEFAULT ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select case _latin1'a' when _latin2'b' then 1 when _latin5'c' collate
|
||||
latin5_turkish_ci then 2 else 3 end;
|
||||
case _latin1'a' when _latin2'b' then 1 when _latin5'c' collate
|
||||
latin5_turkish_ci then 2 else 3 end
|
||||
3
|
||||
select concat(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci);
|
||||
concat(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci)
|
||||
abc
|
||||
243
build/lib/mysql/mysql-test/r/ctype_cp1250_ch.result
Normal file
243
build/lib/mysql/mysql-test/r/ctype_cp1250_ch.result
Normal file
@@ -0,0 +1,243 @@
|
||||
drop table if exists t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
SHOW COLLATION LIKE 'cp1250_czech_cs';
|
||||
Collation Charset Id Default Compiled Sortlen
|
||||
cp1250_czech_cs cp1250 34 Yes 2
|
||||
SET @test_character_set= 'cp1250';
|
||||
SET @test_collation= 'cp1250_general_ci';
|
||||
SET @safe_character_set_server= @@character_set_server;
|
||||
SET @safe_collation_server= @@collation_server;
|
||||
SET @safe_character_set_client= @@character_set_client;
|
||||
SET @safe_character_set_results= @@character_set_results;
|
||||
SET character_set_server= @test_character_set;
|
||||
SET collation_server= @test_collation;
|
||||
CREATE DATABASE d1;
|
||||
USE d1;
|
||||
CREATE TABLE t1 (c CHAR(10), KEY(c));
|
||||
SHOW FULL COLUMNS FROM t1;
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
c char(10) cp1250_general_ci YES MUL NULL
|
||||
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
|
||||
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
|
||||
want3results
|
||||
aaa
|
||||
aaaa
|
||||
aaaaa
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
|
||||
SHOW FULL COLUMNS FROM t1;
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
c1 varchar(15) cp1250_general_ci YES MUL NULL
|
||||
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
|
||||
SELECT c1 as want3results from t1 where c1 like 'l%';
|
||||
want3results
|
||||
location
|
||||
loberge
|
||||
lotre
|
||||
SELECT c1 as want3results from t1 where c1 like 'lo%';
|
||||
want3results
|
||||
location
|
||||
loberge
|
||||
lotre
|
||||
SELECT c1 as want1result from t1 where c1 like 'loc%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'loca%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locat%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locati%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locatio%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'location%';
|
||||
want1result
|
||||
location
|
||||
DROP TABLE t1;
|
||||
create table t1 (a set('a') not null);
|
||||
insert into t1 values (),();
|
||||
Warnings:
|
||||
Warning 1364 Field 'a' doesn't have a default value
|
||||
select cast(a as char(1)) from t1;
|
||||
cast(a as char(1))
|
||||
|
||||
|
||||
select a sounds like a from t1;
|
||||
a sounds like a
|
||||
1
|
||||
1
|
||||
select 1 from t1 order by cast(a as char(1));
|
||||
1
|
||||
1
|
||||
1
|
||||
drop table t1;
|
||||
set names utf8;
|
||||
create table t1 (
|
||||
name varchar(10),
|
||||
level smallint unsigned);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`name` varchar(10) DEFAULT NULL,
|
||||
`level` smallint(5) unsigned DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1250
|
||||
insert into t1 values ('string',1);
|
||||
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
|
||||
concat(name,space(level)) concat(name, repeat(' ',level))
|
||||
string string
|
||||
drop table t1;
|
||||
DROP DATABASE d1;
|
||||
USE test;
|
||||
SET character_set_server= @safe_character_set_server;
|
||||
SET collation_server= @safe_collation_server;
|
||||
SET character_set_client= @safe_character_set_client;
|
||||
SET character_set_results= @safe_character_set_results;
|
||||
SET @test_character_set= 'cp1250';
|
||||
SET @test_collation= 'cp1250_czech_cs';
|
||||
SET @safe_character_set_server= @@character_set_server;
|
||||
SET @safe_collation_server= @@collation_server;
|
||||
SET @safe_character_set_client= @@character_set_client;
|
||||
SET @safe_character_set_results= @@character_set_results;
|
||||
SET character_set_server= @test_character_set;
|
||||
SET collation_server= @test_collation;
|
||||
CREATE DATABASE d1;
|
||||
USE d1;
|
||||
CREATE TABLE t1 (c CHAR(10), KEY(c));
|
||||
SHOW FULL COLUMNS FROM t1;
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
c char(10) cp1250_czech_cs YES MUL NULL
|
||||
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
|
||||
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
|
||||
want3results
|
||||
aaa
|
||||
aaaa
|
||||
aaaaa
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
|
||||
SHOW FULL COLUMNS FROM t1;
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
c1 varchar(15) cp1250_czech_cs YES MUL NULL
|
||||
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
|
||||
SELECT c1 as want3results from t1 where c1 like 'l%';
|
||||
want3results
|
||||
location
|
||||
loberge
|
||||
lotre
|
||||
SELECT c1 as want3results from t1 where c1 like 'lo%';
|
||||
want3results
|
||||
location
|
||||
loberge
|
||||
lotre
|
||||
SELECT c1 as want1result from t1 where c1 like 'loc%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'loca%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locat%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locati%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locatio%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'location%';
|
||||
want1result
|
||||
location
|
||||
DROP TABLE t1;
|
||||
create table t1 (a set('a') not null);
|
||||
insert into t1 values (),();
|
||||
Warnings:
|
||||
Warning 1364 Field 'a' doesn't have a default value
|
||||
select cast(a as char(1)) from t1;
|
||||
cast(a as char(1))
|
||||
|
||||
|
||||
select a sounds like a from t1;
|
||||
a sounds like a
|
||||
1
|
||||
1
|
||||
select 1 from t1 order by cast(a as char(1));
|
||||
1
|
||||
1
|
||||
1
|
||||
drop table t1;
|
||||
set names utf8;
|
||||
create table t1 (
|
||||
name varchar(10),
|
||||
level smallint unsigned);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`name` varchar(10) COLLATE cp1250_czech_cs DEFAULT NULL,
|
||||
`level` smallint(5) unsigned DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1250 COLLATE=cp1250_czech_cs
|
||||
insert into t1 values ('string',1);
|
||||
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
|
||||
concat(name,space(level)) concat(name, repeat(' ',level))
|
||||
string string
|
||||
drop table t1;
|
||||
DROP DATABASE d1;
|
||||
USE test;
|
||||
SET character_set_server= @safe_character_set_server;
|
||||
SET collation_server= @safe_collation_server;
|
||||
SET character_set_client= @safe_character_set_client;
|
||||
SET character_set_results= @safe_character_set_results;
|
||||
CREATE TABLE t1 (a char(16)) character set cp1250 collate cp1250_czech_cs;
|
||||
INSERT INTO t1 VALUES ('');
|
||||
SELECT a, length(a), a='', a=' ', a=' ' FROM t1;
|
||||
a length(a) a='' a=' ' a=' '
|
||||
0 1 1 1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
popisek varchar(30) collate cp1250_general_ci NOT NULL default '',
|
||||
PRIMARY KEY (`popisek`)
|
||||
);
|
||||
INSERT INTO t1 VALUES ('2005-01-1');
|
||||
SELECT * FROM t1 WHERE popisek = '2005-01-1';
|
||||
popisek
|
||||
2005-01-1
|
||||
SELECT * FROM t1 WHERE popisek LIKE '2005-01-1';
|
||||
popisek
|
||||
2005-01-1
|
||||
drop table t1;
|
||||
set names cp1250;
|
||||
CREATE TABLE t1
|
||||
(
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
str VARCHAR(32) CHARACTER SET cp1250 COLLATE cp1250_czech_cs NOT NULL default '',
|
||||
UNIQUE KEY (str)
|
||||
);
|
||||
INSERT INTO t1 VALUES (NULL, 'a');
|
||||
INSERT INTO t1 VALUES (NULL, 'aa');
|
||||
INSERT INTO t1 VALUES (NULL, 'aaa');
|
||||
INSERT INTO t1 VALUES (NULL, 'aaaa');
|
||||
INSERT INTO t1 VALUES (NULL, 'aaaaa');
|
||||
INSERT INTO t1 VALUES (NULL, 'aaaaaa');
|
||||
INSERT INTO t1 VALUES (NULL, 'aaaaaaa');
|
||||
select * from t1 where str like 'aa%';
|
||||
id str
|
||||
2 aa
|
||||
3 aaa
|
||||
4 aaaa
|
||||
5 aaaaa
|
||||
6 aaaaaa
|
||||
7 aaaaaaa
|
||||
drop table t1;
|
||||
set names cp1250;
|
||||
create table t1 (a varchar(15) collate cp1250_czech_cs NOT NULL, primary key(a));
|
||||
insert into t1 values("abcdefghá");
|
||||
insert into t1 values("ááèè");
|
||||
select a from t1 where a like "abcdefghá";
|
||||
a
|
||||
abcdefghá
|
||||
drop table t1;
|
||||
set global LC_MESSAGES=convert((@@global.log_bin_trust_function_creators)
|
||||
using cp1250);
|
||||
ERROR HY000: Unknown system variable 'LC_MESSAGES'
|
||||
382
build/lib/mysql/mysql-test/r/ctype_cp1251.result
Normal file
382
build/lib/mysql/mysql-test/r/ctype_cp1251.result
Normal file
@@ -0,0 +1,382 @@
|
||||
drop table if exists t1;
|
||||
SET NAMES cp1251;
|
||||
create table t1 (a varchar(10) not null) character set cp1251;
|
||||
insert into t1 values ("a"),("ab"),("abc");
|
||||
select * from t1;
|
||||
a
|
||||
a
|
||||
ab
|
||||
abc
|
||||
select a, left(a,1) as b from t1;
|
||||
a b
|
||||
a a
|
||||
ab a
|
||||
abc a
|
||||
select a, left(a,1) as b from t1 group by a;
|
||||
a b
|
||||
a a
|
||||
ab a
|
||||
abc a
|
||||
SELECT DISTINCT RIGHT(a,1) from t1;
|
||||
RIGHT(a,1)
|
||||
a
|
||||
b
|
||||
c
|
||||
drop table t1;
|
||||
create table t1 (a char(3) binary, b binary(3)) character set cp1251;
|
||||
insert into t1 values ('aaa','bbb'),('AAA','BBB');
|
||||
select upper(a),upper(b) from t1;
|
||||
upper(a) upper(b)
|
||||
AAA bbb
|
||||
AAA BBB
|
||||
select lower(a),lower(b) from t1;
|
||||
lower(a) lower(b)
|
||||
aaa bbb
|
||||
aaa BBB
|
||||
select * from t1 where upper(a)='AAA';
|
||||
a b
|
||||
aaa bbb
|
||||
AAA BBB
|
||||
select * from t1 where lower(a)='aaa';
|
||||
a b
|
||||
aaa bbb
|
||||
AAA BBB
|
||||
select * from t1 where upper(b)='BBB';
|
||||
a b
|
||||
AAA BBB
|
||||
select * from t1 where lower(b)='bbb';
|
||||
a b
|
||||
aaa bbb
|
||||
select charset(a), charset(b), charset(binary 'ccc') from t1 limit 1;
|
||||
charset(a) charset(b) charset(binary 'ccc')
|
||||
cp1251 binary binary
|
||||
select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1;
|
||||
collation(a) collation(b) collation(binary 'ccc')
|
||||
cp1251_bin binary binary
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
a varchar(16) character set cp1251 collate cp1251_bin not null,
|
||||
b int(10) default null,
|
||||
primary key(a)
|
||||
) charset=cp1251;
|
||||
insert into t1 (a) values ('air'),
|
||||
('we'),('g'),('we_toshko'), ('s0urce'),('we_ivo'),('we_iliyan'),
|
||||
('we_martin'),('vw_grado'),('vw_vasko'),('tn_vili'),('tn_kalina'),
|
||||
('tn_fakira'),('vw_silvia'),('vw_starshi'),('vw_geo'),('vw_b0x1');
|
||||
select * from t1 where a like 'we_%';
|
||||
a b
|
||||
we_iliyan NULL
|
||||
we_ivo NULL
|
||||
we_martin NULL
|
||||
we_toshko NULL
|
||||
drop table t1;
|
||||
#
|
||||
# Start of 5.1 tests
|
||||
#
|
||||
SELECT @@collation_connection;
|
||||
@@collation_connection
|
||||
cp1251_general_ci
|
||||
CREATE TABLE t1 AS SELECT ' ' AS a LIMIT 0;
|
||||
INSERT INTO t1 VALUES (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07);
|
||||
INSERT INTO t1 VALUES (0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
|
||||
INSERT INTO t1 VALUES (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17);
|
||||
INSERT INTO t1 VALUES (0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
|
||||
INSERT INTO t1 VALUES (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27);
|
||||
INSERT INTO t1 VALUES (0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
|
||||
INSERT INTO t1 VALUES (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37);
|
||||
INSERT INTO t1 VALUES (0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
|
||||
INSERT INTO t1 VALUES (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47);
|
||||
INSERT INTO t1 VALUES (0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
|
||||
INSERT INTO t1 VALUES (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57);
|
||||
INSERT INTO t1 VALUES (0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
|
||||
INSERT INTO t1 VALUES (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67);
|
||||
INSERT INTO t1 VALUES (0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
|
||||
INSERT INTO t1 VALUES (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77);
|
||||
INSERT INTO t1 VALUES (0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
|
||||
INSERT INTO t1 VALUES (0x80),(0x81),(0x82),(0x83),(0x84),(0x85),(0x86),(0x87);
|
||||
INSERT INTO t1 VALUES (0x88),(0x89),(0x8A),(0x8B),(0x8C),(0x8D),(0x8E),(0x8F);
|
||||
INSERT INTO t1 VALUES (0x90),(0x91),(0x92),(0x93),(0x94),(0x95),(0x96),(0x97);
|
||||
INSERT INTO t1 VALUES (0x98),(0x99),(0x9A),(0x9B),(0x9C),(0x9D),(0x9E),(0x9F);
|
||||
INSERT INTO t1 VALUES (0xA0),(0xA1),(0xA2),(0xA3),(0xA4),(0xA5),(0xA6),(0xA7);
|
||||
INSERT INTO t1 VALUES (0xA8),(0xA9),(0xAA),(0xAB),(0xAC),(0xAD),(0xAE),(0xAF);
|
||||
INSERT INTO t1 VALUES (0xB0),(0xB1),(0xB2),(0xB3),(0xB4),(0xB5),(0xB6),(0xB7);
|
||||
INSERT INTO t1 VALUES (0xB8),(0xB9),(0xBA),(0xBB),(0xBC),(0xBD),(0xBE),(0xBF);
|
||||
INSERT INTO t1 VALUES (0xC0),(0xC1),(0xC2),(0xC3),(0xC4),(0xC5),(0xC6),(0xC7);
|
||||
INSERT INTO t1 VALUES (0xC8),(0xC9),(0xCA),(0xCB),(0xCC),(0xCD),(0xCE),(0xCF);
|
||||
INSERT INTO t1 VALUES (0xD0),(0xD1),(0xD2),(0xD3),(0xD4),(0xD5),(0xD6),(0xD7);
|
||||
INSERT INTO t1 VALUES (0xD8),(0xD9),(0xDA),(0xDB),(0xDC),(0xDD),(0xDE),(0xDF);
|
||||
INSERT INTO t1 VALUES (0xE0),(0xE1),(0xE2),(0xE3),(0xE4),(0xE5),(0xE6),(0xE7);
|
||||
INSERT INTO t1 VALUES (0xE8),(0xE9),(0xEA),(0xEB),(0xEC),(0xED),(0xEE),(0xEF);
|
||||
INSERT INTO t1 VALUES (0xF0),(0xF1),(0xF2),(0xF3),(0xF4),(0xF5),(0xF6),(0xF7);
|
||||
INSERT INTO t1 VALUES (0xF8),(0xF9),(0xFA),(0xFB),(0xFC),(0xFD),(0xFE),(0xFF);
|
||||
SELECT
|
||||
HEX(a) AS chr,
|
||||
HEX(LOWER(a)) AS upper,
|
||||
HEX(LOWER(a)) AS lower,
|
||||
HEX(@utf8:=CONVERT(a USING utf8)) AS utf8,
|
||||
HEX(@roundtrip:=CAST(@utf8 AS CHAR)) AS roundtrip,
|
||||
if(a=BINARY @roundtrip,'','Round trip unsafe') AS issafe
|
||||
FROM t1 ORDER BY chr;
|
||||
chr upper lower utf8 roundtrip issafe
|
||||
00 00 00 00 00
|
||||
01 01 01 01 01
|
||||
02 02 02 02 02
|
||||
03 03 03 03 03
|
||||
04 04 04 04 04
|
||||
05 05 05 05 05
|
||||
06 06 06 06 06
|
||||
07 07 07 07 07
|
||||
08 08 08 08 08
|
||||
09 09 09 09 09
|
||||
0A 0A 0A 0A 0A
|
||||
0B 0B 0B 0B 0B
|
||||
0C 0C 0C 0C 0C
|
||||
0D 0D 0D 0D 0D
|
||||
0E 0E 0E 0E 0E
|
||||
0F 0F 0F 0F 0F
|
||||
10 10 10 10 10
|
||||
11 11 11 11 11
|
||||
12 12 12 12 12
|
||||
13 13 13 13 13
|
||||
14 14 14 14 14
|
||||
15 15 15 15 15
|
||||
16 16 16 16 16
|
||||
17 17 17 17 17
|
||||
18 18 18 18 18
|
||||
19 19 19 19 19
|
||||
1A 1A 1A 1A 1A
|
||||
1B 1B 1B 1B 1B
|
||||
1C 1C 1C 1C 1C
|
||||
1D 1D 1D 1D 1D
|
||||
1E 1E 1E 1E 1E
|
||||
1F 1F 1F 1F 1F
|
||||
20 20 20 20 20
|
||||
21 21 21 21 21
|
||||
22 22 22 22 22
|
||||
23 23 23 23 23
|
||||
24 24 24 24 24
|
||||
25 25 25 25 25
|
||||
26 26 26 26 26
|
||||
27 27 27 27 27
|
||||
28 28 28 28 28
|
||||
29 29 29 29 29
|
||||
2A 2A 2A 2A 2A
|
||||
2B 2B 2B 2B 2B
|
||||
2C 2C 2C 2C 2C
|
||||
2D 2D 2D 2D 2D
|
||||
2E 2E 2E 2E 2E
|
||||
2F 2F 2F 2F 2F
|
||||
30 30 30 30 30
|
||||
31 31 31 31 31
|
||||
32 32 32 32 32
|
||||
33 33 33 33 33
|
||||
34 34 34 34 34
|
||||
35 35 35 35 35
|
||||
36 36 36 36 36
|
||||
37 37 37 37 37
|
||||
38 38 38 38 38
|
||||
39 39 39 39 39
|
||||
3A 3A 3A 3A 3A
|
||||
3B 3B 3B 3B 3B
|
||||
3C 3C 3C 3C 3C
|
||||
3D 3D 3D 3D 3D
|
||||
3E 3E 3E 3E 3E
|
||||
3F 3F 3F 3F 3F
|
||||
40 40 40 40 40
|
||||
41 61 61 41 41
|
||||
42 62 62 42 42
|
||||
43 63 63 43 43
|
||||
44 64 64 44 44
|
||||
45 65 65 45 45
|
||||
46 66 66 46 46
|
||||
47 67 67 47 47
|
||||
48 68 68 48 48
|
||||
49 69 69 49 49
|
||||
4A 6A 6A 4A 4A
|
||||
4B 6B 6B 4B 4B
|
||||
4C 6C 6C 4C 4C
|
||||
4D 6D 6D 4D 4D
|
||||
4E 6E 6E 4E 4E
|
||||
4F 6F 6F 4F 4F
|
||||
50 70 70 50 50
|
||||
51 71 71 51 51
|
||||
52 72 72 52 52
|
||||
53 73 73 53 53
|
||||
54 74 74 54 54
|
||||
55 75 75 55 55
|
||||
56 76 76 56 56
|
||||
57 77 77 57 57
|
||||
58 78 78 58 58
|
||||
59 79 79 59 59
|
||||
5A 7A 7A 5A 5A
|
||||
5B 5B 5B 5B 5B
|
||||
5C 5C 5C 5C 5C
|
||||
5D 5D 5D 5D 5D
|
||||
5E 5E 5E 5E 5E
|
||||
5F 5F 5F 5F 5F
|
||||
60 60 60 60 60
|
||||
61 61 61 61 61
|
||||
62 62 62 62 62
|
||||
63 63 63 63 63
|
||||
64 64 64 64 64
|
||||
65 65 65 65 65
|
||||
66 66 66 66 66
|
||||
67 67 67 67 67
|
||||
68 68 68 68 68
|
||||
69 69 69 69 69
|
||||
6A 6A 6A 6A 6A
|
||||
6B 6B 6B 6B 6B
|
||||
6C 6C 6C 6C 6C
|
||||
6D 6D 6D 6D 6D
|
||||
6E 6E 6E 6E 6E
|
||||
6F 6F 6F 6F 6F
|
||||
70 70 70 70 70
|
||||
71 71 71 71 71
|
||||
72 72 72 72 72
|
||||
73 73 73 73 73
|
||||
74 74 74 74 74
|
||||
75 75 75 75 75
|
||||
76 76 76 76 76
|
||||
77 77 77 77 77
|
||||
78 78 78 78 78
|
||||
79 79 79 79 79
|
||||
7A 7A 7A 7A 7A
|
||||
7B 7B 7B 7B 7B
|
||||
7C 7C 7C 7C 7C
|
||||
7D 7D 7D 7D 7D
|
||||
7E 7E 7E 7E 7E
|
||||
7F 7F 7F 7F 7F
|
||||
80 90 90 D082 80
|
||||
81 83 83 D083 81
|
||||
82 82 82 E2809A 82
|
||||
83 83 83 D193 83
|
||||
84 84 84 E2809E 84
|
||||
85 85 85 E280A6 85
|
||||
86 86 86 E280A0 86
|
||||
87 87 87 E280A1 87
|
||||
88 88 88 E282AC 88
|
||||
89 89 89 E280B0 89
|
||||
8A 9A 9A D089 8A
|
||||
8B 8B 8B E280B9 8B
|
||||
8C 9C 9C D08A 8C
|
||||
8D 9D 9D D08C 8D
|
||||
8E 9E 9E D08B 8E
|
||||
8F 9F 9F D08F 8F
|
||||
90 90 90 D192 90
|
||||
91 91 91 E28098 91
|
||||
92 92 92 E28099 92
|
||||
93 93 93 E2809C 93
|
||||
94 94 94 E2809D 94
|
||||
95 95 95 E280A2 95
|
||||
96 96 96 E28093 96
|
||||
97 97 97 E28094 97
|
||||
98 98 98 3F 3F Round trip unsafe
|
||||
99 99 99 E284A2 99
|
||||
9A 9A 9A D199 9A
|
||||
9B 9B 9B E280BA 9B
|
||||
9C 9C 9C D19A 9C
|
||||
9D 9D 9D D19C 9D
|
||||
9E 9E 9E D19B 9E
|
||||
9F 9F 9F D19F 9F
|
||||
A0 A0 A0 C2A0 A0
|
||||
A1 A2 A2 D08E A1
|
||||
A2 A2 A2 D19E A2
|
||||
A3 BC BC D088 A3
|
||||
A4 A4 A4 C2A4 A4
|
||||
A5 B4 B4 D290 A5
|
||||
A6 A6 A6 C2A6 A6
|
||||
A7 A7 A7 C2A7 A7
|
||||
A8 B8 B8 D081 A8
|
||||
A9 A9 A9 C2A9 A9
|
||||
AA BA BA D084 AA
|
||||
AB AB AB C2AB AB
|
||||
AC AC AC C2AC AC
|
||||
AD AD AD C2AD AD
|
||||
AE AE AE C2AE AE
|
||||
AF BF BF D087 AF
|
||||
B0 B0 B0 C2B0 B0
|
||||
B1 B1 B1 C2B1 B1
|
||||
B2 B3 B3 D086 B2
|
||||
B3 B3 B3 D196 B3
|
||||
B4 B4 B4 D291 B4
|
||||
B5 B5 B5 C2B5 B5
|
||||
B6 B6 B6 C2B6 B6
|
||||
B7 B7 B7 C2B7 B7
|
||||
B8 B8 B8 D191 B8
|
||||
B9 B9 B9 E28496 B9
|
||||
BA BA BA D194 BA
|
||||
BB BB BB C2BB BB
|
||||
BC BC BC D198 BC
|
||||
BD BE BE D085 BD
|
||||
BE BE BE D195 BE
|
||||
BF BF BF D197 BF
|
||||
C0 E0 E0 D090 C0
|
||||
C1 E1 E1 D091 C1
|
||||
C2 E2 E2 D092 C2
|
||||
C3 E3 E3 D093 C3
|
||||
C4 E4 E4 D094 C4
|
||||
C5 E5 E5 D095 C5
|
||||
C6 E6 E6 D096 C6
|
||||
C7 E7 E7 D097 C7
|
||||
C8 E8 E8 D098 C8
|
||||
C9 E9 E9 D099 C9
|
||||
CA EA EA D09A CA
|
||||
CB EB EB D09B CB
|
||||
CC EC EC D09C CC
|
||||
CD ED ED D09D CD
|
||||
CE EE EE D09E CE
|
||||
CF EF EF D09F CF
|
||||
D0 F0 F0 D0A0 D0
|
||||
D1 F1 F1 D0A1 D1
|
||||
D2 F2 F2 D0A2 D2
|
||||
D3 F3 F3 D0A3 D3
|
||||
D4 F4 F4 D0A4 D4
|
||||
D5 F5 F5 D0A5 D5
|
||||
D6 F6 F6 D0A6 D6
|
||||
D7 F7 F7 D0A7 D7
|
||||
D8 F8 F8 D0A8 D8
|
||||
D9 F9 F9 D0A9 D9
|
||||
DA FA FA D0AA DA
|
||||
DB FB FB D0AB DB
|
||||
DC FC FC D0AC DC
|
||||
DD FD FD D0AD DD
|
||||
DE FE FE D0AE DE
|
||||
DF FF FF D0AF DF
|
||||
E0 E0 E0 D0B0 E0
|
||||
E1 E1 E1 D0B1 E1
|
||||
E2 E2 E2 D0B2 E2
|
||||
E3 E3 E3 D0B3 E3
|
||||
E4 E4 E4 D0B4 E4
|
||||
E5 E5 E5 D0B5 E5
|
||||
E6 E6 E6 D0B6 E6
|
||||
E7 E7 E7 D0B7 E7
|
||||
E8 E8 E8 D0B8 E8
|
||||
E9 E9 E9 D0B9 E9
|
||||
EA EA EA D0BA EA
|
||||
EB EB EB D0BB EB
|
||||
EC EC EC D0BC EC
|
||||
ED ED ED D0BD ED
|
||||
EE EE EE D0BE EE
|
||||
EF EF EF D0BF EF
|
||||
F0 F0 F0 D180 F0
|
||||
F1 F1 F1 D181 F1
|
||||
F2 F2 F2 D182 F2
|
||||
F3 F3 F3 D183 F3
|
||||
F4 F4 F4 D184 F4
|
||||
F5 F5 F5 D185 F5
|
||||
F6 F6 F6 D186 F6
|
||||
F7 F7 F7 D187 F7
|
||||
F8 F8 F8 D188 F8
|
||||
F9 F9 F9 D189 F9
|
||||
FA FA FA D18A FA
|
||||
FB FB FB D18B FB
|
||||
FC FC FC D18C FC
|
||||
FD FD FD D18D FD
|
||||
FE FE FE D18E FE
|
||||
FF FF FF D18F FF
|
||||
DROP TABLE t1;
|
||||
set global LC_TIME_NAMES=convert((-8388608) using cp1251);
|
||||
ERROR HY000: Unknown locale: '-8388608'
|
||||
#
|
||||
# End of 5.1 tests
|
||||
#
|
||||
19
build/lib/mysql/mysql-test/r/ctype_cp932_binlog_row.result
Normal file
19
build/lib/mysql/mysql-test/r/ctype_cp932_binlog_row.result
Normal file
@@ -0,0 +1,19 @@
|
||||
drop table if exists t1;
|
||||
set names cp932;
|
||||
set character_set_database = cp932;
|
||||
RESET MASTER;
|
||||
CREATE TABLE t1(f1 blob);
|
||||
PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)';
|
||||
SET @var1= x'8300';
|
||||
EXECUTE stmt1 USING @var1;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1(f1 blob)
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
SELECT HEX(f1) FROM t1;
|
||||
HEX(f1)
|
||||
8300
|
||||
DROP table t1;
|
||||
58
build/lib/mysql/mysql-test/r/ctype_cp932_binlog_stm.result
Normal file
58
build/lib/mysql/mysql-test/r/ctype_cp932_binlog_stm.result
Normal file
@@ -0,0 +1,58 @@
|
||||
drop table if exists t1;
|
||||
set names cp932;
|
||||
set character_set_database = cp932;
|
||||
RESET MASTER;
|
||||
CREATE TABLE t1(f1 blob);
|
||||
PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)';
|
||||
SET @var1= x'8300';
|
||||
EXECUTE stmt1 USING @var1;
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1(f1 blob)
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES(0x8300)
|
||||
SELECT HEX(f1) FROM t1;
|
||||
HEX(f1)
|
||||
8300
|
||||
DROP table t1;
|
||||
CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
|
||||
s2 CHAR(50) CHARACTER SET cp932,
|
||||
d DECIMAL(10,2))|
|
||||
CREATE PROCEDURE bug18293 (IN ins1 CHAR(50),
|
||||
IN ins2 CHAR(50) CHARACTER SET cp932,
|
||||
IN ind DECIMAL(10,2))
|
||||
BEGIN
|
||||
INSERT INTO t4 VALUES (ins1, ins2, ind);
|
||||
END|
|
||||
CALL bug18293("Foo's a Bar", _cp932 0xED40ED41ED42, 47.93)|
|
||||
SELECT HEX(s1),HEX(s2),d FROM t4|
|
||||
HEX(s1) HEX(s2) d
|
||||
466F6F2773206120426172 ED40ED41ED42 47.93
|
||||
DROP PROCEDURE bug18293|
|
||||
DROP TABLE t4|
|
||||
show binlog events from <binlog_start>|
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
|
||||
s2 CHAR(50) CHARACTER SET cp932,
|
||||
d DECIMAL(10,2))
|
||||
master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `bug18293`(IN ins1 CHAR(50),
|
||||
IN ins2 CHAR(50) CHARACTER SET cp932,
|
||||
IN ind DECIMAL(10,2))
|
||||
BEGIN
|
||||
INSERT INTO t4 VALUES (ins1, ins2, ind);
|
||||
END
|
||||
master-bin.000001 # Query # # use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172 COLLATE 'latin1_swedish_ci'), NAME_CONST('ins2',_cp932 0xED40ED41ED42 COLLATE 'cp932_japanese_ci'), NAME_CONST('ind',47.93))
|
||||
master-bin.000001 # Query # # use `test`; DROP PROCEDURE bug18293
|
||||
master-bin.000001 # Query # # use `test`; DROP TABLE t4
|
||||
End of 5.0 tests
|
||||
call mtr.add_suppression("Error in Log_event::read_log_event\\\(\\\): 'Sanity check failed', data_len: 258, event_type: 49");
|
||||
SHOW BINLOG EVENTS FROM 365;
|
||||
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
|
||||
Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
|
||||
CREATE TABLE t1 (a varchar(16)) character set cp932;
|
||||
INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
|
||||
SELECT hex(a), hex(lower(a)), hex(upper(a)) FROM t1 ORDER BY binary(a);
|
||||
hex(a) hex(lower(a)) hex(upper(a))
|
||||
8352835E 8352835E 8352835E
|
||||
8372835E 8372835E 8372835E
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
78
build/lib/mysql/mysql-test/r/ctype_create.result
Normal file
78
build/lib/mysql/mysql-test/r/ctype_create.result
Normal file
@@ -0,0 +1,78 @@
|
||||
SET @@character_set_server=latin5;
|
||||
CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET cp1251;
|
||||
USE mysqltest1;
|
||||
CREATE DATABASE mysqltest2;
|
||||
SHOW CREATE DATABASE mysqltest1;
|
||||
Database Create Database
|
||||
mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp1251 */
|
||||
SHOW CREATE DATABASE mysqltest2;
|
||||
Database Create Database
|
||||
mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin5 */
|
||||
CREATE TABLE mysqltest2.t1 (a char(10));
|
||||
SHOW CREATE TABLE mysqltest2.t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` char(10) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin5
|
||||
DROP TABLE mysqltest2.t1;
|
||||
ALTER DATABASE mysqltest2 DEFAULT CHARACTER SET latin7;
|
||||
CREATE TABLE mysqltest2.t1 (a char(10));
|
||||
SHOW CREATE TABLE mysqltest2.t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` char(10) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin7
|
||||
DROP DATABASE mysqltest2;
|
||||
CREATE DATABASE mysqltest2 CHARACTER SET latin2;
|
||||
CREATE TABLE mysqltest2.t1 (a char(10));
|
||||
SHOW CREATE TABLE mysqltest2.t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` char(10) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin2
|
||||
DROP DATABASE mysqltest2;
|
||||
USE mysqltest1;
|
||||
CREATE TABLE t1 (a char(10));
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` char(10) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a char(10)) DEFAULT CHARACTER SET latin1;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` char(10) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a char(10))
|
||||
DEFAULT CHARACTER SET latin1 COLLATE latin1_german1_ci;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` char(10) COLLATE latin1_german1_ci DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci
|
||||
DROP TABLE t1;
|
||||
create table t1 (a char) character set latin1 character set latin2;
|
||||
ERROR HY000: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET latin2'
|
||||
create table t1 (a char) character set latin1 collate latin2_bin;
|
||||
ERROR 42000: COLLATION 'latin2_bin' is not valid for CHARACTER SET 'latin1'
|
||||
create database d1 default character set latin1 character set latin2;
|
||||
ERROR HY000: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET latin2'
|
||||
create database d1 default character set latin1 collate latin2_bin;
|
||||
ERROR 42000: COLLATION 'latin2_bin' is not valid for CHARACTER SET 'latin1'
|
||||
DROP DATABASE mysqltest1;
|
||||
CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET latin7;
|
||||
use mysqltest2;
|
||||
ALTER DATABASE DEFAULT CHARACTER SET latin2;
|
||||
show create database mysqltest2;
|
||||
Database Create Database
|
||||
mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 */
|
||||
drop database mysqltest2;
|
||||
ALTER DATABASE DEFAULT CHARACTER SET latin2;
|
||||
ERROR 3D000: No database selected
|
||||
ALTER DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa DEFAULT CHARACTER SET latin2;
|
||||
ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
|
||||
ALTER DATABASE `` DEFAULT CHARACTER SET latin2;
|
||||
ERROR 42000: Incorrect database name ''
|
||||
9863
build/lib/mysql/mysql-test/r/ctype_eucjpms.result
Normal file
9863
build/lib/mysql/mysql-test/r/ctype_eucjpms.result
Normal file
File diff suppressed because it is too large
Load Diff
24257
build/lib/mysql/mysql-test/r/ctype_euckr.result
Normal file
24257
build/lib/mysql/mysql-test/r/ctype_euckr.result
Normal file
File diff suppressed because it is too large
Load Diff
13
build/lib/mysql/mysql-test/r/ctype_filename.result
Normal file
13
build/lib/mysql/mysql-test/r/ctype_filename.result
Normal file
@@ -0,0 +1,13 @@
|
||||
drop table if exists con, aux, nul, lpt1, com1, `clock$`;
|
||||
create table con (a int);
|
||||
drop table con;
|
||||
create table aux (a int);
|
||||
drop table aux;
|
||||
create table nul (a int);
|
||||
drop table nul;
|
||||
create table lpt1 (a int);
|
||||
drop table lpt1;
|
||||
create table com1 (a int);
|
||||
drop table com1;
|
||||
create table `clock$` (a int);
|
||||
drop table `clock$`;
|
||||
11
build/lib/mysql/mysql-test/r/ctype_filesystem.result
Normal file
11
build/lib/mysql/mysql-test/r/ctype_filesystem.result
Normal file
@@ -0,0 +1,11 @@
|
||||
SET CHARACTER SET utf8;
|
||||
SHOW VARIABLES like 'character_sets_dir';
|
||||
Variable_name Value
|
||||
character_sets_dir MYSQL_TEST_DIR/ß/
|
||||
SHOW VARIABLES like 'character_set_filesystem';
|
||||
Variable_name Value
|
||||
character_set_filesystem latin1
|
||||
SHOW VARIABLES like 'character_set_client';
|
||||
Variable_name Value
|
||||
character_set_client utf8
|
||||
SET CHARACTER SET default;
|
||||
237
build/lib/mysql/mysql-test/r/ctype_gb2312.result
Normal file
237
build/lib/mysql/mysql-test/r/ctype_gb2312.result
Normal file
@@ -0,0 +1,237 @@
|
||||
drop table if exists t1;
|
||||
SET @test_character_set= 'gb2312';
|
||||
SET @test_collation= 'gb2312_chinese_ci';
|
||||
SET @safe_character_set_server= @@character_set_server;
|
||||
SET @safe_collation_server= @@collation_server;
|
||||
SET @safe_character_set_client= @@character_set_client;
|
||||
SET @safe_character_set_results= @@character_set_results;
|
||||
SET character_set_server= @test_character_set;
|
||||
SET collation_server= @test_collation;
|
||||
CREATE DATABASE d1;
|
||||
USE d1;
|
||||
CREATE TABLE t1 (c CHAR(10), KEY(c));
|
||||
SHOW FULL COLUMNS FROM t1;
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
c char(10) gb2312_chinese_ci YES MUL NULL
|
||||
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
|
||||
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
|
||||
want3results
|
||||
aaa
|
||||
aaaa
|
||||
aaaaa
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
|
||||
SHOW FULL COLUMNS FROM t1;
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
c1 varchar(15) gb2312_chinese_ci YES MUL NULL
|
||||
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
|
||||
SELECT c1 as want3results from t1 where c1 like 'l%';
|
||||
want3results
|
||||
location
|
||||
loberge
|
||||
lotre
|
||||
SELECT c1 as want3results from t1 where c1 like 'lo%';
|
||||
want3results
|
||||
location
|
||||
loberge
|
||||
lotre
|
||||
SELECT c1 as want1result from t1 where c1 like 'loc%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'loca%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locat%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locati%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locatio%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'location%';
|
||||
want1result
|
||||
location
|
||||
DROP TABLE t1;
|
||||
create table t1 (a set('a') not null);
|
||||
insert into t1 values (),();
|
||||
Warnings:
|
||||
Warning 1364 Field 'a' doesn't have a default value
|
||||
select cast(a as char(1)) from t1;
|
||||
cast(a as char(1))
|
||||
|
||||
|
||||
select a sounds like a from t1;
|
||||
a sounds like a
|
||||
1
|
||||
1
|
||||
select 1 from t1 order by cast(a as char(1));
|
||||
1
|
||||
1
|
||||
1
|
||||
drop table t1;
|
||||
set names utf8;
|
||||
create table t1 (
|
||||
name varchar(10),
|
||||
level smallint unsigned);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`name` varchar(10) DEFAULT NULL,
|
||||
`level` smallint(5) unsigned DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=gb2312
|
||||
insert into t1 values ('string',1);
|
||||
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
|
||||
concat(name,space(level)) concat(name, repeat(' ',level))
|
||||
string string
|
||||
drop table t1;
|
||||
DROP DATABASE d1;
|
||||
USE test;
|
||||
SET character_set_server= @safe_character_set_server;
|
||||
SET collation_server= @safe_collation_server;
|
||||
SET character_set_client= @safe_character_set_client;
|
||||
SET character_set_results= @safe_character_set_results;
|
||||
SET NAMES gb2312;
|
||||
SET collation_connection='gb2312_chinese_ci';
|
||||
create table t1 select repeat('a',4000) a;
|
||||
delete from t1;
|
||||
insert into t1 values ('a'), ('a '), ('a\t');
|
||||
select collation(a),hex(a) from t1 order by a;
|
||||
collation(a) hex(a)
|
||||
gb2312_chinese_ci 6109
|
||||
gb2312_chinese_ci 61
|
||||
gb2312_chinese_ci 6120
|
||||
drop table t1;
|
||||
create table t1 engine=innodb select repeat('a',50) as c1;
|
||||
alter table t1 add index(c1(5));
|
||||
insert into t1 values ('abcdefg'),('abcde100'),('abcde110'),('abcde111');
|
||||
select collation(c1) from t1 limit 1;
|
||||
collation(c1)
|
||||
gb2312_chinese_ci
|
||||
select c1 from t1 where c1 like 'abcdef%' order by c1;
|
||||
c1
|
||||
abcdefg
|
||||
select c1 from t1 where c1 like 'abcde1%' order by c1;
|
||||
c1
|
||||
abcde100
|
||||
abcde110
|
||||
abcde111
|
||||
select c1 from t1 where c1 like 'abcde11%' order by c1;
|
||||
c1
|
||||
abcde110
|
||||
abcde111
|
||||
select c1 from t1 where c1 like 'abcde111%' order by c1;
|
||||
c1
|
||||
abcde111
|
||||
drop table t1;
|
||||
select @@collation_connection;
|
||||
@@collation_connection
|
||||
gb2312_chinese_ci
|
||||
create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
|
||||
insert into t1 values('abcdef');
|
||||
insert into t1 values('_bcdef');
|
||||
insert into t1 values('a_cdef');
|
||||
insert into t1 values('ab_def');
|
||||
insert into t1 values('abc_ef');
|
||||
insert into t1 values('abcd_f');
|
||||
insert into t1 values('abcde_');
|
||||
select c1 as c1u from t1 where c1 like 'ab\_def';
|
||||
c1u
|
||||
ab_def
|
||||
select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
|
||||
c2h
|
||||
ab_def
|
||||
drop table t1;
|
||||
CREATE TABLE t1 AS
|
||||
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
|
||||
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
|
||||
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
|
||||
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
|
||||
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
|
||||
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
|
||||
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
|
||||
hex(concat(repeat(0xF1F2, 10), '%'))
|
||||
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
|
||||
3 rows expected
|
||||
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
|
||||
a hex(b) c
|
||||
2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
||||
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
||||
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
||||
DROP TABLE t1;
|
||||
SET collation_connection='gb2312_bin';
|
||||
create table t1 select repeat('a',4000) a;
|
||||
delete from t1;
|
||||
insert into t1 values ('a'), ('a '), ('a\t');
|
||||
select collation(a),hex(a) from t1 order by a;
|
||||
collation(a) hex(a)
|
||||
gb2312_bin 6109
|
||||
gb2312_bin 61
|
||||
gb2312_bin 6120
|
||||
drop table t1;
|
||||
create table t1 engine=innodb select repeat('a',50) as c1;
|
||||
alter table t1 add index(c1(5));
|
||||
insert into t1 values ('abcdefg'),('abcde100'),('abcde110'),('abcde111');
|
||||
select collation(c1) from t1 limit 1;
|
||||
collation(c1)
|
||||
gb2312_bin
|
||||
select c1 from t1 where c1 like 'abcdef%' order by c1;
|
||||
c1
|
||||
abcdefg
|
||||
select c1 from t1 where c1 like 'abcde1%' order by c1;
|
||||
c1
|
||||
abcde100
|
||||
abcde110
|
||||
abcde111
|
||||
select c1 from t1 where c1 like 'abcde11%' order by c1;
|
||||
c1
|
||||
abcde110
|
||||
abcde111
|
||||
select c1 from t1 where c1 like 'abcde111%' order by c1;
|
||||
c1
|
||||
abcde111
|
||||
drop table t1;
|
||||
select @@collation_connection;
|
||||
@@collation_connection
|
||||
gb2312_bin
|
||||
create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
|
||||
insert into t1 values('abcdef');
|
||||
insert into t1 values('_bcdef');
|
||||
insert into t1 values('a_cdef');
|
||||
insert into t1 values('ab_def');
|
||||
insert into t1 values('abc_ef');
|
||||
insert into t1 values('abcd_f');
|
||||
insert into t1 values('abcde_');
|
||||
select c1 as c1u from t1 where c1 like 'ab\_def';
|
||||
c1u
|
||||
ab_def
|
||||
select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
|
||||
c2h
|
||||
ab_def
|
||||
drop table t1;
|
||||
CREATE TABLE t1 AS
|
||||
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
|
||||
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
|
||||
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
|
||||
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
|
||||
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
|
||||
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
|
||||
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
|
||||
hex(concat(repeat(0xF1F2, 10), '%'))
|
||||
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
|
||||
3 rows expected
|
||||
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
|
||||
a hex(b) c
|
||||
2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
||||
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
||||
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
||||
DROP TABLE t1;
|
||||
SET NAMES gb2312;
|
||||
CREATE TABLE t1 (a text) character set gb2312;
|
||||
INSERT INTO t1 VALUES (0xA2A1),(0xD7FE);
|
||||
SELECT hex(a) FROM t1 ORDER BY a;
|
||||
hex(a)
|
||||
A2A1
|
||||
D7FE
|
||||
DROP TABLE t1;
|
||||
257
build/lib/mysql/mysql-test/r/ctype_gbk.result
Normal file
257
build/lib/mysql/mysql-test/r/ctype_gbk.result
Normal file
@@ -0,0 +1,257 @@
|
||||
drop table if exists t1;
|
||||
SET @test_character_set= 'gbk';
|
||||
SET @test_collation= 'gbk_chinese_ci';
|
||||
SET @safe_character_set_server= @@character_set_server;
|
||||
SET @safe_collation_server= @@collation_server;
|
||||
SET @safe_character_set_client= @@character_set_client;
|
||||
SET @safe_character_set_results= @@character_set_results;
|
||||
SET character_set_server= @test_character_set;
|
||||
SET collation_server= @test_collation;
|
||||
CREATE DATABASE d1;
|
||||
USE d1;
|
||||
CREATE TABLE t1 (c CHAR(10), KEY(c));
|
||||
SHOW FULL COLUMNS FROM t1;
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
c char(10) gbk_chinese_ci YES MUL NULL
|
||||
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
|
||||
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
|
||||
want3results
|
||||
aaa
|
||||
aaaa
|
||||
aaaaa
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
|
||||
SHOW FULL COLUMNS FROM t1;
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
c1 varchar(15) gbk_chinese_ci YES MUL NULL
|
||||
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
|
||||
SELECT c1 as want3results from t1 where c1 like 'l%';
|
||||
want3results
|
||||
location
|
||||
loberge
|
||||
lotre
|
||||
SELECT c1 as want3results from t1 where c1 like 'lo%';
|
||||
want3results
|
||||
location
|
||||
loberge
|
||||
lotre
|
||||
SELECT c1 as want1result from t1 where c1 like 'loc%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'loca%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locat%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locati%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'locatio%';
|
||||
want1result
|
||||
location
|
||||
SELECT c1 as want1result from t1 where c1 like 'location%';
|
||||
want1result
|
||||
location
|
||||
DROP TABLE t1;
|
||||
create table t1 (a set('a') not null);
|
||||
insert into t1 values (),();
|
||||
Warnings:
|
||||
Warning 1364 Field 'a' doesn't have a default value
|
||||
select cast(a as char(1)) from t1;
|
||||
cast(a as char(1))
|
||||
|
||||
|
||||
select a sounds like a from t1;
|
||||
a sounds like a
|
||||
1
|
||||
1
|
||||
select 1 from t1 order by cast(a as char(1));
|
||||
1
|
||||
1
|
||||
1
|
||||
drop table t1;
|
||||
set names utf8;
|
||||
create table t1 (
|
||||
name varchar(10),
|
||||
level smallint unsigned);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`name` varchar(10) DEFAULT NULL,
|
||||
`level` smallint(5) unsigned DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=gbk
|
||||
insert into t1 values ('string',1);
|
||||
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
|
||||
concat(name,space(level)) concat(name, repeat(' ',level))
|
||||
string string
|
||||
drop table t1;
|
||||
DROP DATABASE d1;
|
||||
USE test;
|
||||
SET character_set_server= @safe_character_set_server;
|
||||
SET collation_server= @safe_collation_server;
|
||||
SET character_set_client= @safe_character_set_client;
|
||||
SET character_set_results= @safe_character_set_results;
|
||||
SET NAMES gbk;
|
||||
SET collation_connection='gbk_chinese_ci';
|
||||
create table t1 select repeat('a',4000) a;
|
||||
delete from t1;
|
||||
insert into t1 values ('a'), ('a '), ('a\t');
|
||||
select collation(a),hex(a) from t1 order by a;
|
||||
collation(a) hex(a)
|
||||
gbk_chinese_ci 6109
|
||||
gbk_chinese_ci 61
|
||||
gbk_chinese_ci 6120
|
||||
drop table t1;
|
||||
create table t1 engine=innodb select repeat('a',50) as c1;
|
||||
alter table t1 add index(c1(5));
|
||||
insert into t1 values ('abcdefg'),('abcde100'),('abcde110'),('abcde111');
|
||||
select collation(c1) from t1 limit 1;
|
||||
collation(c1)
|
||||
gbk_chinese_ci
|
||||
select c1 from t1 where c1 like 'abcdef%' order by c1;
|
||||
c1
|
||||
abcdefg
|
||||
select c1 from t1 where c1 like 'abcde1%' order by c1;
|
||||
c1
|
||||
abcde100
|
||||
abcde110
|
||||
abcde111
|
||||
select c1 from t1 where c1 like 'abcde11%' order by c1;
|
||||
c1
|
||||
abcde110
|
||||
abcde111
|
||||
select c1 from t1 where c1 like 'abcde111%' order by c1;
|
||||
c1
|
||||
abcde111
|
||||
drop table t1;
|
||||
select @@collation_connection;
|
||||
@@collation_connection
|
||||
gbk_chinese_ci
|
||||
create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
|
||||
insert into t1 values('abcdef');
|
||||
insert into t1 values('_bcdef');
|
||||
insert into t1 values('a_cdef');
|
||||
insert into t1 values('ab_def');
|
||||
insert into t1 values('abc_ef');
|
||||
insert into t1 values('abcd_f');
|
||||
insert into t1 values('abcde_');
|
||||
select c1 as c1u from t1 where c1 like 'ab\_def';
|
||||
c1u
|
||||
ab_def
|
||||
select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
|
||||
c2h
|
||||
ab_def
|
||||
drop table t1;
|
||||
CREATE TABLE t1 AS
|
||||
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
|
||||
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
|
||||
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
|
||||
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
|
||||
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
|
||||
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
|
||||
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
|
||||
hex(concat(repeat(0xF1F2, 10), '%'))
|
||||
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
|
||||
3 rows expected
|
||||
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
|
||||
a hex(b) c
|
||||
2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
||||
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
||||
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
||||
DROP TABLE t1;
|
||||
SET collation_connection='gbk_bin';
|
||||
create table t1 select repeat('a',4000) a;
|
||||
delete from t1;
|
||||
insert into t1 values ('a'), ('a '), ('a\t');
|
||||
select collation(a),hex(a) from t1 order by a;
|
||||
collation(a) hex(a)
|
||||
gbk_bin 6109
|
||||
gbk_bin 61
|
||||
gbk_bin 6120
|
||||
drop table t1;
|
||||
create table t1 engine=innodb select repeat('a',50) as c1;
|
||||
alter table t1 add index(c1(5));
|
||||
insert into t1 values ('abcdefg'),('abcde100'),('abcde110'),('abcde111');
|
||||
select collation(c1) from t1 limit 1;
|
||||
collation(c1)
|
||||
gbk_bin
|
||||
select c1 from t1 where c1 like 'abcdef%' order by c1;
|
||||
c1
|
||||
abcdefg
|
||||
select c1 from t1 where c1 like 'abcde1%' order by c1;
|
||||
c1
|
||||
abcde100
|
||||
abcde110
|
||||
abcde111
|
||||
select c1 from t1 where c1 like 'abcde11%' order by c1;
|
||||
c1
|
||||
abcde110
|
||||
abcde111
|
||||
select c1 from t1 where c1 like 'abcde111%' order by c1;
|
||||
c1
|
||||
abcde111
|
||||
drop table t1;
|
||||
select @@collation_connection;
|
||||
@@collation_connection
|
||||
gbk_bin
|
||||
create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
|
||||
insert into t1 values('abcdef');
|
||||
insert into t1 values('_bcdef');
|
||||
insert into t1 values('a_cdef');
|
||||
insert into t1 values('ab_def');
|
||||
insert into t1 values('abc_ef');
|
||||
insert into t1 values('abcd_f');
|
||||
insert into t1 values('abcde_');
|
||||
select c1 as c1u from t1 where c1 like 'ab\_def';
|
||||
c1u
|
||||
ab_def
|
||||
select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
|
||||
c2h
|
||||
ab_def
|
||||
drop table t1;
|
||||
CREATE TABLE t1 AS
|
||||
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
|
||||
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
|
||||
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
|
||||
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
|
||||
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
|
||||
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
|
||||
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
|
||||
hex(concat(repeat(0xF1F2, 10), '%'))
|
||||
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
|
||||
3 rows expected
|
||||
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
|
||||
a hex(b) c
|
||||
2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
||||
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
||||
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
||||
DROP TABLE t1;
|
||||
SET NAMES gbk;
|
||||
CREATE TABLE t1 (a text) character set gbk;
|
||||
INSERT INTO t1 VALUES (0xA3A0),(0xA1A1);
|
||||
SELECT hex(a) FROM t1 ORDER BY a;
|
||||
hex(a)
|
||||
A1A1
|
||||
A3A0
|
||||
DROP TABLE t1;
|
||||
select hex(convert(_gbk 0xA14041 using ucs2));
|
||||
hex(convert(_gbk 0xA14041 using ucs2))
|
||||
003F0041
|
||||
create table t1 (c1 text not null, c2 text not null) character set gbk;
|
||||
alter table t1 change c1 c1 mediumtext character set gbk not null;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` mediumtext NOT NULL,
|
||||
`c2` text NOT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=gbk
|
||||
drop table t1;
|
||||
CREATE TABLE t1(a MEDIUMTEXT CHARACTER SET gbk,
|
||||
b MEDIUMTEXT CHARACTER SET big5);
|
||||
INSERT INTO t1 VALUES
|
||||
(REPEAT(0x1125,200000), REPEAT(0x1125,200000)), ('', ''), ('', '');
|
||||
SELECT a FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll;
|
||||
SELECT b FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll;
|
||||
DROP TABLES t1;
|
||||
End of 5.0 tests
|
||||
27
build/lib/mysql/mysql-test/r/ctype_gbk_binlog.result
Normal file
27
build/lib/mysql/mysql-test/r/ctype_gbk_binlog.result
Normal file
@@ -0,0 +1,27 @@
|
||||
RESET MASTER;
|
||||
SET NAMES gbk;
|
||||
CREATE TABLE t1 (
|
||||
f1 BLOB
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=gbk;
|
||||
CREATE PROCEDURE p1(IN val BLOB)
|
||||
BEGIN
|
||||
SET @tval = val;
|
||||
SET @sql_cmd = CONCAT_WS(' ', 'insert into t1(f1) values(?)');
|
||||
PREPARE stmt FROM @sql_cmd;
|
||||
EXECUTE stmt USING @tval;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
END|
|
||||
SET @`tcontent`:=_binary 0x50434B000900000000000000E9000000 COLLATE `binary`/*!*/;
|
||||
CALL p1(@`tcontent`);
|
||||
FLUSH LOGS;
|
||||
DROP PROCEDURE p1;
|
||||
RENAME TABLE t1 to t2;
|
||||
SELECT hex(f1) FROM t2;
|
||||
hex(f1)
|
||||
50434B000900000000000000E9000000
|
||||
SELECT hex(f1) FROM t1;
|
||||
hex(f1)
|
||||
50434B000900000000000000E9000000
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
11
build/lib/mysql/mysql-test/r/ctype_hebrew.result
Normal file
11
build/lib/mysql/mysql-test/r/ctype_hebrew.result
Normal file
@@ -0,0 +1,11 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
SET NAMES hebrew;
|
||||
CREATE TABLE t1 (a char(1)) DEFAULT CHARSET=hebrew;
|
||||
INSERT INTO t1 VALUES (0xFD),(0xFE);
|
||||
ALTER TABLE t1 CONVERT TO CHARACTER SET utf8;
|
||||
SELECT HEX(a) FROM t1;
|
||||
HEX(a)
|
||||
E2808E
|
||||
E2808F
|
||||
DROP TABLE t1;
|
||||
End of 4.1 tests
|
||||
419
build/lib/mysql/mysql-test/r/ctype_latin1.result
Normal file
419
build/lib/mysql/mysql-test/r/ctype_latin1.result
Normal file
@@ -0,0 +1,419 @@
|
||||
drop table if exists t1;
|
||||
SET NAMES latin1;
|
||||
CREATE TABLE t1 (a char(1) character set latin1);
|
||||
INSERT INTO t1 VALUES (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07);
|
||||
INSERT INTO t1 VALUES (0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
|
||||
INSERT INTO t1 VALUES (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17);
|
||||
INSERT INTO t1 VALUES (0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
|
||||
INSERT INTO t1 VALUES (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27);
|
||||
INSERT INTO t1 VALUES (0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
|
||||
INSERT INTO t1 VALUES (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37);
|
||||
INSERT INTO t1 VALUES (0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
|
||||
INSERT INTO t1 VALUES (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47);
|
||||
INSERT INTO t1 VALUES (0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
|
||||
INSERT INTO t1 VALUES (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57);
|
||||
INSERT INTO t1 VALUES (0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
|
||||
INSERT INTO t1 VALUES (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67);
|
||||
INSERT INTO t1 VALUES (0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
|
||||
INSERT INTO t1 VALUES (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77);
|
||||
INSERT INTO t1 VALUES (0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
|
||||
INSERT INTO t1 VALUES (0x80),(0x81),(0x82),(0x83),(0x84),(0x85),(0x86),(0x87);
|
||||
INSERT INTO t1 VALUES (0x88),(0x89),(0x8A),(0x8B),(0x8C),(0x8D),(0x8E),(0x8F);
|
||||
INSERT INTO t1 VALUES (0x90),(0x91),(0x92),(0x93),(0x94),(0x95),(0x96),(0x97);
|
||||
INSERT INTO t1 VALUES (0x98),(0x99),(0x9A),(0x9B),(0x9C),(0x9D),(0x9E),(0x9F);
|
||||
INSERT INTO t1 VALUES (0xA0),(0xA1),(0xA2),(0xA3),(0xA4),(0xA5),(0xA6),(0xA7);
|
||||
INSERT INTO t1 VALUES (0xA8),(0xA9),(0xAA),(0xAB),(0xAC),(0xAD),(0xAE),(0xAF);
|
||||
INSERT INTO t1 VALUES (0xB0),(0xB1),(0xB2),(0xB3),(0xB4),(0xB5),(0xB6),(0xB7);
|
||||
INSERT INTO t1 VALUES (0xB8),(0xB9),(0xBA),(0xBB),(0xBC),(0xBD),(0xBE),(0xBF);
|
||||
INSERT INTO t1 VALUES (0xC0),(0xC1),(0xC2),(0xC3),(0xC4),(0xC5),(0xC6),(0xC7);
|
||||
INSERT INTO t1 VALUES (0xC8),(0xC9),(0xCA),(0xCB),(0xCC),(0xCD),(0xCE),(0xCF);
|
||||
INSERT INTO t1 VALUES (0xD0),(0xD1),(0xD2),(0xD3),(0xD4),(0xD5),(0xD6),(0xD7);
|
||||
INSERT INTO t1 VALUES (0xD8),(0xD9),(0xDA),(0xDB),(0xDC),(0xDD),(0xDE),(0xDF);
|
||||
INSERT INTO t1 VALUES (0xE0),(0xE1),(0xE2),(0xE3),(0xE4),(0xE5),(0xE6),(0xE7);
|
||||
INSERT INTO t1 VALUES (0xE8),(0xE9),(0xEA),(0xEB),(0xEC),(0xED),(0xEE),(0xEF);
|
||||
INSERT INTO t1 VALUES (0xF0),(0xF1),(0xF2),(0xF3),(0xF4),(0xF5),(0xF6),(0xF7);
|
||||
INSERT INTO t1 VALUES (0xF8),(0xF9),(0xFA),(0xFB),(0xFC),(0xFD),(0xFE),(0xFF);
|
||||
SELECT
|
||||
hex(a),
|
||||
hex(@u:=convert(a using utf8)),
|
||||
hex(@l:=convert(@u using latin1)),
|
||||
a=@l FROM t1;
|
||||
hex(a) hex(@u:=convert(a using utf8)) hex(@l:=convert(@u using latin1)) a=@l
|
||||
00 00 00 1
|
||||
01 01 01 1
|
||||
02 02 02 1
|
||||
03 03 03 1
|
||||
04 04 04 1
|
||||
05 05 05 1
|
||||
06 06 06 1
|
||||
07 07 07 1
|
||||
08 08 08 1
|
||||
09 09 09 1
|
||||
0A 0A 0A 1
|
||||
0B 0B 0B 1
|
||||
0C 0C 0C 1
|
||||
0D 0D 0D 1
|
||||
0E 0E 0E 1
|
||||
0F 0F 0F 1
|
||||
10 10 10 1
|
||||
11 11 11 1
|
||||
12 12 12 1
|
||||
13 13 13 1
|
||||
14 14 14 1
|
||||
15 15 15 1
|
||||
16 16 16 1
|
||||
17 17 17 1
|
||||
18 18 18 1
|
||||
19 19 19 1
|
||||
1A 1A 1A 1
|
||||
1B 1B 1B 1
|
||||
1C 1C 1C 1
|
||||
1D 1D 1D 1
|
||||
1E 1E 1E 1
|
||||
1F 1F 1F 1
|
||||
1
|
||||
21 21 21 1
|
||||
22 22 22 1
|
||||
23 23 23 1
|
||||
24 24 24 1
|
||||
25 25 25 1
|
||||
26 26 26 1
|
||||
27 27 27 1
|
||||
28 28 28 1
|
||||
29 29 29 1
|
||||
2A 2A 2A 1
|
||||
2B 2B 2B 1
|
||||
2C 2C 2C 1
|
||||
2D 2D 2D 1
|
||||
2E 2E 2E 1
|
||||
2F 2F 2F 1
|
||||
30 30 30 1
|
||||
31 31 31 1
|
||||
32 32 32 1
|
||||
33 33 33 1
|
||||
34 34 34 1
|
||||
35 35 35 1
|
||||
36 36 36 1
|
||||
37 37 37 1
|
||||
38 38 38 1
|
||||
39 39 39 1
|
||||
3A 3A 3A 1
|
||||
3B 3B 3B 1
|
||||
3C 3C 3C 1
|
||||
3D 3D 3D 1
|
||||
3E 3E 3E 1
|
||||
3F 3F 3F 1
|
||||
40 40 40 1
|
||||
41 41 41 1
|
||||
42 42 42 1
|
||||
43 43 43 1
|
||||
44 44 44 1
|
||||
45 45 45 1
|
||||
46 46 46 1
|
||||
47 47 47 1
|
||||
48 48 48 1
|
||||
49 49 49 1
|
||||
4A 4A 4A 1
|
||||
4B 4B 4B 1
|
||||
4C 4C 4C 1
|
||||
4D 4D 4D 1
|
||||
4E 4E 4E 1
|
||||
4F 4F 4F 1
|
||||
50 50 50 1
|
||||
51 51 51 1
|
||||
52 52 52 1
|
||||
53 53 53 1
|
||||
54 54 54 1
|
||||
55 55 55 1
|
||||
56 56 56 1
|
||||
57 57 57 1
|
||||
58 58 58 1
|
||||
59 59 59 1
|
||||
5A 5A 5A 1
|
||||
5B 5B 5B 1
|
||||
5C 5C 5C 1
|
||||
5D 5D 5D 1
|
||||
5E 5E 5E 1
|
||||
5F 5F 5F 1
|
||||
60 60 60 1
|
||||
61 61 61 1
|
||||
62 62 62 1
|
||||
63 63 63 1
|
||||
64 64 64 1
|
||||
65 65 65 1
|
||||
66 66 66 1
|
||||
67 67 67 1
|
||||
68 68 68 1
|
||||
69 69 69 1
|
||||
6A 6A 6A 1
|
||||
6B 6B 6B 1
|
||||
6C 6C 6C 1
|
||||
6D 6D 6D 1
|
||||
6E 6E 6E 1
|
||||
6F 6F 6F 1
|
||||
70 70 70 1
|
||||
71 71 71 1
|
||||
72 72 72 1
|
||||
73 73 73 1
|
||||
74 74 74 1
|
||||
75 75 75 1
|
||||
76 76 76 1
|
||||
77 77 77 1
|
||||
78 78 78 1
|
||||
79 79 79 1
|
||||
7A 7A 7A 1
|
||||
7B 7B 7B 1
|
||||
7C 7C 7C 1
|
||||
7D 7D 7D 1
|
||||
7E 7E 7E 1
|
||||
7F 7F 7F 1
|
||||
80 E282AC 80 1
|
||||
81 C281 81 1
|
||||
82 E2809A 82 1
|
||||
83 C692 83 1
|
||||
84 E2809E 84 1
|
||||
85 E280A6 85 1
|
||||
86 E280A0 86 1
|
||||
87 E280A1 87 1
|
||||
88 CB86 88 1
|
||||
89 E280B0 89 1
|
||||
8A C5A0 8A 1
|
||||
8B E280B9 8B 1
|
||||
8C C592 8C 1
|
||||
8D C28D 8D 1
|
||||
8E C5BD 8E 1
|
||||
8F C28F 8F 1
|
||||
90 C290 90 1
|
||||
91 E28098 91 1
|
||||
92 E28099 92 1
|
||||
93 E2809C 93 1
|
||||
94 E2809D 94 1
|
||||
95 E280A2 95 1
|
||||
96 E28093 96 1
|
||||
97 E28094 97 1
|
||||
98 CB9C 98 1
|
||||
99 E284A2 99 1
|
||||
9A C5A1 9A 1
|
||||
9B E280BA 9B 1
|
||||
9C C593 9C 1
|
||||
9D C29D 9D 1
|
||||
9E C5BE 9E 1
|
||||
9F C5B8 9F 1
|
||||
A0 C2A0 A0 1
|
||||
A1 C2A1 A1 1
|
||||
A2 C2A2 A2 1
|
||||
A3 C2A3 A3 1
|
||||
A4 C2A4 A4 1
|
||||
A5 C2A5 A5 1
|
||||
A6 C2A6 A6 1
|
||||
A7 C2A7 A7 1
|
||||
A8 C2A8 A8 1
|
||||
A9 C2A9 A9 1
|
||||
AA C2AA AA 1
|
||||
AB C2AB AB 1
|
||||
AC C2AC AC 1
|
||||
AD C2AD AD 1
|
||||
AE C2AE AE 1
|
||||
AF C2AF AF 1
|
||||
B0 C2B0 B0 1
|
||||
B1 C2B1 B1 1
|
||||
B2 C2B2 B2 1
|
||||
B3 C2B3 B3 1
|
||||
B4 C2B4 B4 1
|
||||
B5 C2B5 B5 1
|
||||
B6 C2B6 B6 1
|
||||
B7 C2B7 B7 1
|
||||
B8 C2B8 B8 1
|
||||
B9 C2B9 B9 1
|
||||
BA C2BA BA 1
|
||||
BB C2BB BB 1
|
||||
BC C2BC BC 1
|
||||
BD C2BD BD 1
|
||||
BE C2BE BE 1
|
||||
BF C2BF BF 1
|
||||
C0 C380 C0 1
|
||||
C1 C381 C1 1
|
||||
C2 C382 C2 1
|
||||
C3 C383 C3 1
|
||||
C4 C384 C4 1
|
||||
C5 C385 C5 1
|
||||
C6 C386 C6 1
|
||||
C7 C387 C7 1
|
||||
C8 C388 C8 1
|
||||
C9 C389 C9 1
|
||||
CA C38A CA 1
|
||||
CB C38B CB 1
|
||||
CC C38C CC 1
|
||||
CD C38D CD 1
|
||||
CE C38E CE 1
|
||||
CF C38F CF 1
|
||||
D0 C390 D0 1
|
||||
D1 C391 D1 1
|
||||
D2 C392 D2 1
|
||||
D3 C393 D3 1
|
||||
D4 C394 D4 1
|
||||
D5 C395 D5 1
|
||||
D6 C396 D6 1
|
||||
D7 C397 D7 1
|
||||
D8 C398 D8 1
|
||||
D9 C399 D9 1
|
||||
DA C39A DA 1
|
||||
DB C39B DB 1
|
||||
DC C39C DC 1
|
||||
DD C39D DD 1
|
||||
DE C39E DE 1
|
||||
DF C39F DF 1
|
||||
E0 C3A0 E0 1
|
||||
E1 C3A1 E1 1
|
||||
E2 C3A2 E2 1
|
||||
E3 C3A3 E3 1
|
||||
E4 C3A4 E4 1
|
||||
E5 C3A5 E5 1
|
||||
E6 C3A6 E6 1
|
||||
E7 C3A7 E7 1
|
||||
E8 C3A8 E8 1
|
||||
E9 C3A9 E9 1
|
||||
EA C3AA EA 1
|
||||
EB C3AB EB 1
|
||||
EC C3AC EC 1
|
||||
ED C3AD ED 1
|
||||
EE C3AE EE 1
|
||||
EF C3AF EF 1
|
||||
F0 C3B0 F0 1
|
||||
F1 C3B1 F1 1
|
||||
F2 C3B2 F2 1
|
||||
F3 C3B3 F3 1
|
||||
F4 C3B4 F4 1
|
||||
F5 C3B5 F5 1
|
||||
F6 C3B6 F6 1
|
||||
F7 C3B7 F7 1
|
||||
F8 C3B8 F8 1
|
||||
F9 C3B9 F9 1
|
||||
FA C3BA FA 1
|
||||
FB C3BB FB 1
|
||||
FC C3BC FC 1
|
||||
FD C3BD FD 1
|
||||
FE C3BE FE 1
|
||||
FF C3BF FF 1
|
||||
DROP TABLE t1;
|
||||
SELECT 1 as ƒ, 2 as Š, 3 as Œ, 4 as Ž, 5 as š, 6 as œ, 7 as ž, 8 as Ÿ;
|
||||
ƒ Š Œ Ž š œ ž Ÿ
|
||||
1 2 3 4 5 6 7 8
|
||||
select 'a' regexp 'A' collate latin1_general_ci;
|
||||
'a' regexp 'A' collate latin1_general_ci
|
||||
1
|
||||
select 'a' regexp 'A' collate latin1_general_cs;
|
||||
'a' regexp 'A' collate latin1_general_cs
|
||||
0
|
||||
select 'a' regexp 'A' collate latin1_bin;
|
||||
'a' regexp 'A' collate latin1_bin
|
||||
0
|
||||
SET collation_connection='latin1_swedish_ci';
|
||||
create table t1 select repeat('a',4000) a;
|
||||
delete from t1;
|
||||
insert into t1 values ('a'), ('a '), ('a\t');
|
||||
select collation(a),hex(a) from t1 order by a;
|
||||
collation(a) hex(a)
|
||||
latin1_swedish_ci 6109
|
||||
latin1_swedish_ci 61
|
||||
latin1_swedish_ci 6120
|
||||
drop table t1;
|
||||
select @@collation_connection;
|
||||
@@collation_connection
|
||||
latin1_swedish_ci
|
||||
create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
|
||||
insert into t1 values('abcdef');
|
||||
insert into t1 values('_bcdef');
|
||||
insert into t1 values('a_cdef');
|
||||
insert into t1 values('ab_def');
|
||||
insert into t1 values('abc_ef');
|
||||
insert into t1 values('abcd_f');
|
||||
insert into t1 values('abcde_');
|
||||
select c1 as c1u from t1 where c1 like 'ab\_def';
|
||||
c1u
|
||||
ab_def
|
||||
select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
|
||||
c2h
|
||||
ab_def
|
||||
drop table t1;
|
||||
SET collation_connection='latin1_bin';
|
||||
create table t1 select repeat('a',4000) a;
|
||||
delete from t1;
|
||||
insert into t1 values ('a'), ('a '), ('a\t');
|
||||
select collation(a),hex(a) from t1 order by a;
|
||||
collation(a) hex(a)
|
||||
latin1_bin 6109
|
||||
latin1_bin 61
|
||||
latin1_bin 6120
|
||||
drop table t1;
|
||||
select @@collation_connection;
|
||||
@@collation_connection
|
||||
latin1_bin
|
||||
create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
|
||||
insert into t1 values('abcdef');
|
||||
insert into t1 values('_bcdef');
|
||||
insert into t1 values('a_cdef');
|
||||
insert into t1 values('ab_def');
|
||||
insert into t1 values('abc_ef');
|
||||
insert into t1 values('abcd_f');
|
||||
insert into t1 values('abcde_');
|
||||
select c1 as c1u from t1 where c1 like 'ab\_def';
|
||||
c1u
|
||||
ab_def
|
||||
select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
|
||||
c2h
|
||||
ab_def
|
||||
drop table t1;
|
||||
CREATE TABLE „a (a int);
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '„a (a int)' at line 1
|
||||
SELECT '„a' as str;
|
||||
str
|
||||
„a
|
||||
set @str= _latin1 'ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈÌÒÙ @ abc';
|
||||
SELECT convert(@str collate latin1_bin using utf8);
|
||||
convert(@str collate latin1_bin using utf8)
|
||||
ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈÌÒÙ @ abc
|
||||
SELECT convert(@str collate latin1_general_ci using utf8);
|
||||
convert(@str collate latin1_general_ci using utf8)
|
||||
ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈÌÒÙ @ abc
|
||||
SELECT convert(@str collate latin1_german1_ci using utf8);
|
||||
convert(@str collate latin1_german1_ci using utf8)
|
||||
ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈÌÒÙ @ abc
|
||||
SELECT convert(@str collate latin1_danish_ci using utf8);
|
||||
convert(@str collate latin1_danish_ci using utf8)
|
||||
ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈÌÒÙ @ abc
|
||||
SELECT convert(@str collate latin1_spanish_ci using utf8);
|
||||
convert(@str collate latin1_spanish_ci using utf8)
|
||||
ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈÌÒÙ @ abc
|
||||
SELECT convert(@str collate latin1_german2_ci using utf8);
|
||||
convert(@str collate latin1_german2_ci using utf8)
|
||||
ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈÌÒÙ @ abc
|
||||
SELECT convert(@str collate latin1_swedish_ci using utf8);
|
||||
convert(@str collate latin1_swedish_ci using utf8)
|
||||
ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈÌÒÙ @ abc
|
||||
SET NAMES latin1;
|
||||
DROP TABLE IF EXISTS `abcÿdef`;
|
||||
CREATE TABLE `abcÿdef` (i int);
|
||||
INSERT INTO `abcÿdef` VALUES (1);
|
||||
INSERT INTO abcÿdef VALUES (2);
|
||||
SELECT * FROM `abcÿdef`;
|
||||
i
|
||||
1
|
||||
2
|
||||
SELECT * FROM abcÿdef;
|
||||
i
|
||||
1
|
||||
2
|
||||
DROP TABLE `abcÿdef`;
|
||||
select hex(cast(_ascii 0x7f as char(1) character set latin1));
|
||||
hex(cast(_ascii 0x7f as char(1) character set latin1))
|
||||
7F
|
||||
End of 5.0 tests
|
||||
#
|
||||
# Bug#58022 ... like ... escape export_set ( ... ) crashes when export_set returns warnings
|
||||
#
|
||||
SELECT '' LIKE '' ESCAPE EXPORT_SET(1, 1, 1, 1, '');
|
||||
'' LIKE '' ESCAPE EXPORT_SET(1, 1, 1, 1, '')
|
||||
1
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: ''
|
||||
381
build/lib/mysql/mysql-test/r/ctype_latin1_de.result
Normal file
381
build/lib/mysql/mysql-test/r/ctype_latin1_de.result
Normal file
@@ -0,0 +1,381 @@
|
||||
set names latin1;
|
||||
set @@collation_connection=latin1_german2_ci;
|
||||
select @@collation_connection;
|
||||
@@collation_connection
|
||||
latin1_german2_ci
|
||||
drop table if exists t1;
|
||||
create table t1 (a char (20) not null, b int not null auto_increment, index (a,b));
|
||||
insert into t1 (a) values ('ä'),('ac'),('ae'),('ad'),('Äc'),('aeb');
|
||||
insert into t1 (a) values ('üc'),('uc'),('ue'),('ud'),('Ü'),('ueb'),('uf');
|
||||
insert into t1 (a) values ('ö'),('oc'),('Öa'),('oe'),('od'),('Öc'),('oeb');
|
||||
insert into t1 (a) values ('s'),('ss'),('ß'),('ßb'),('ssa'),('ssc'),('ßa');
|
||||
insert into t1 (a) values ('eä'),('uü'),('öo'),('ää'),('ääa'),('aeae');
|
||||
insert into t1 (a) values ('q'),('a'),('u'),('o'),('é'),('É'),('a');
|
||||
select a,b from t1 order by a,b;
|
||||
a b
|
||||
a 1
|
||||
a 2
|
||||
ac 1
|
||||
ad 1
|
||||
ä 1
|
||||
ae 2
|
||||
ää 1
|
||||
aeae 2
|
||||
ääa 1
|
||||
aeb 1
|
||||
Äc 1
|
||||
é 1
|
||||
É 2
|
||||
eä 1
|
||||
o 1
|
||||
oc 1
|
||||
od 1
|
||||
ö 1
|
||||
oe 2
|
||||
Öa 1
|
||||
oeb 1
|
||||
Öc 1
|
||||
öo 1
|
||||
q 1
|
||||
s 1
|
||||
ss 1
|
||||
ß 2
|
||||
ssa 1
|
||||
ßa 2
|
||||
ßb 1
|
||||
ssc 1
|
||||
u 1
|
||||
uc 1
|
||||
ud 1
|
||||
ue 1
|
||||
Ü 2
|
||||
ueb 1
|
||||
üc 1
|
||||
uf 1
|
||||
uü 1
|
||||
select a,b from t1 order by upper(a),b;
|
||||
a b
|
||||
a 1
|
||||
a 2
|
||||
ac 1
|
||||
ad 1
|
||||
ä 1
|
||||
ae 2
|
||||
ää 1
|
||||
aeae 2
|
||||
ääa 1
|
||||
aeb 1
|
||||
Äc 1
|
||||
é 1
|
||||
É 2
|
||||
eä 1
|
||||
o 1
|
||||
oc 1
|
||||
od 1
|
||||
ö 1
|
||||
oe 2
|
||||
Öa 1
|
||||
oeb 1
|
||||
Öc 1
|
||||
öo 1
|
||||
q 1
|
||||
s 1
|
||||
ss 1
|
||||
ß 2
|
||||
ssa 1
|
||||
ßa 2
|
||||
ßb 1
|
||||
ssc 1
|
||||
u 1
|
||||
uc 1
|
||||
ud 1
|
||||
ue 1
|
||||
Ü 2
|
||||
ueb 1
|
||||
üc 1
|
||||
uf 1
|
||||
uü 1
|
||||
select a from t1 order by a desc;
|
||||
a
|
||||
uü
|
||||
uf
|
||||
üc
|
||||
ueb
|
||||
Ü
|
||||
ue
|
||||
ud
|
||||
uc
|
||||
u
|
||||
ssc
|
||||
ßb
|
||||
ßa
|
||||
ssa
|
||||
ß
|
||||
ss
|
||||
s
|
||||
q
|
||||
öo
|
||||
Öc
|
||||
oeb
|
||||
Öa
|
||||
oe
|
||||
ö
|
||||
od
|
||||
oc
|
||||
o
|
||||
eä
|
||||
É
|
||||
é
|
||||
Äc
|
||||
aeb
|
||||
ääa
|
||||
aeae
|
||||
ää
|
||||
ae
|
||||
ä
|
||||
ad
|
||||
ac
|
||||
a
|
||||
a
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
select * from t1 where a like "ö%";
|
||||
a b
|
||||
ö 1
|
||||
Öa 1
|
||||
Öc 1
|
||||
öo 1
|
||||
select * from t1 where a like binary "%É%";
|
||||
a b
|
||||
É 2
|
||||
select * from t1 where a like "%Á%";
|
||||
a b
|
||||
a 1
|
||||
a 2
|
||||
ac 1
|
||||
ad 1
|
||||
ae 2
|
||||
aeae 2
|
||||
ääa 1
|
||||
aeb 1
|
||||
Öa 1
|
||||
ssa 1
|
||||
ßa 2
|
||||
select * from t1 where a like "%U%";
|
||||
a b
|
||||
u 1
|
||||
uc 1
|
||||
ud 1
|
||||
ue 1
|
||||
ueb 1
|
||||
uf 1
|
||||
uü 1
|
||||
select * from t1 where a like "%ss%";
|
||||
a b
|
||||
ss 1
|
||||
ssa 1
|
||||
ssc 1
|
||||
drop table t1;
|
||||
select strcmp('ä','ae'),strcmp('ae','ä'),strcmp('aeq','äq'),strcmp('äq','aeq');
|
||||
strcmp('ä','ae') strcmp('ae','ä') strcmp('aeq','äq') strcmp('äq','aeq')
|
||||
0 0 0 0
|
||||
select strcmp('ss','ß'),strcmp('ß','ss'),strcmp('ßs','sss'),strcmp('ßq','ssq');
|
||||
strcmp('ss','ß') strcmp('ß','ss') strcmp('ßs','sss') strcmp('ßq','ssq')
|
||||
0 0 0 0
|
||||
select strcmp('ä','af'),strcmp('a','ä'),strcmp('ää','aeq'),strcmp('ää','aeaeq');
|
||||
strcmp('ä','af') strcmp('a','ä') strcmp('ää','aeq') strcmp('ää','aeaeq')
|
||||
-1 -1 -1 -1
|
||||
select strcmp('ss','ßa'),strcmp('ß','ssa'),strcmp('sßa','sssb'),strcmp('s','ß');
|
||||
strcmp('ss','ßa') strcmp('ß','ssa') strcmp('sßa','sssb') strcmp('s','ß')
|
||||
-1 -1 -1 -1
|
||||
select strcmp('ö','oö'),strcmp('Ü','uü'),strcmp('ö','oeb');
|
||||
strcmp('ö','oö') strcmp('Ü','uü') strcmp('ö','oeb')
|
||||
-1 -1 -1
|
||||
select strcmp('af','ä'),strcmp('ä','a'),strcmp('aeq','ää'),strcmp('aeaeq','ää');
|
||||
strcmp('af','ä') strcmp('ä','a') strcmp('aeq','ää') strcmp('aeaeq','ää')
|
||||
1 1 1 1
|
||||
select strcmp('ßa','ss'),strcmp('ssa','ß'),strcmp('sssb','sßa'),strcmp('ß','s');
|
||||
strcmp('ßa','ss') strcmp('ssa','ß') strcmp('sssb','sßa') strcmp('ß','s')
|
||||
1 1 1 1
|
||||
select strcmp('u','öa'),strcmp('u','ö');
|
||||
strcmp('u','öa') strcmp('u','ö')
|
||||
1 1
|
||||
select strcmp('sä', 'ßa'), strcmp('aä', 'äx');
|
||||
strcmp('sä', 'ßa') strcmp('aä', 'äx')
|
||||
-1 -1
|
||||
create table t1 (a varchar(10), key(a), fulltext (a));
|
||||
insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
|
||||
select * from t1 where a like "abc%";
|
||||
a
|
||||
abc
|
||||
abcd
|
||||
select * from t1 where a like "test%";
|
||||
a
|
||||
test
|
||||
select * from t1 where a like "te_t";
|
||||
a
|
||||
test
|
||||
select * from t1 where match a against ("te*" in boolean mode)+0;
|
||||
a
|
||||
test
|
||||
drop table t1;
|
||||
create table t1 (word varchar(255) not null, word2 varchar(255) not null default '', index(word));
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`word` varchar(255) COLLATE latin1_german2_ci NOT NULL,
|
||||
`word2` varchar(255) COLLATE latin1_german2_ci NOT NULL DEFAULT '',
|
||||
KEY `word` (`word`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci
|
||||
insert into t1 (word) values ('ss'),(0xDF),(0xE4),('ae');
|
||||
update t1 set word2=word;
|
||||
select word, word=binary 0xdf as t from t1 having t > 0;
|
||||
word t
|
||||
ß 1
|
||||
select word, word=cast(0xdf AS CHAR) as t from t1 having t > 0;
|
||||
word t
|
||||
ss 1
|
||||
ß 1
|
||||
select * from t1 where word=binary 0xDF;
|
||||
word word2
|
||||
ß ß
|
||||
select * from t1 where word=CAST(0xDF as CHAR);
|
||||
word word2
|
||||
ss ss
|
||||
ß ß
|
||||
select * from t1 where word2=binary 0xDF;
|
||||
word word2
|
||||
ß ß
|
||||
select * from t1 where word2=CAST(0xDF as CHAR);
|
||||
word word2
|
||||
ss ss
|
||||
ß ß
|
||||
select * from t1 where word='ae';
|
||||
word word2
|
||||
ä ä
|
||||
ae ae
|
||||
select * from t1 where word= 0xe4 or word=CAST(0xe4 as CHAR);
|
||||
word word2
|
||||
ä ä
|
||||
ae ae
|
||||
select * from t1 where word between binary 0xDF and binary 0xDF;
|
||||
word word2
|
||||
ß ß
|
||||
select * from t1 where word between CAST(0xDF AS CHAR) and CAST(0xDF AS CHAR);
|
||||
word word2
|
||||
ss ss
|
||||
ß ß
|
||||
select * from t1 where word like 'ae';
|
||||
word word2
|
||||
ae ae
|
||||
select * from t1 where word like 'AE';
|
||||
word word2
|
||||
ae ae
|
||||
select * from t1 where word like binary 0xDF;
|
||||
word word2
|
||||
ß ß
|
||||
select * from t1 where word like CAST(0xDF as CHAR);
|
||||
word word2
|
||||
ß ß
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
autor varchar(80) NOT NULL default '',
|
||||
PRIMARY KEY (autor)
|
||||
);
|
||||
INSERT INTO t1 VALUES ('Powell, B.'),('Powell, Bud.'),('Powell, L. H.'),('Power, H.'),
|
||||
('Poynter, M. A. L. Lane'),('Poynting, J. H. und J. J. Thomson.'),('Pozzi, S(amuel-Jean).'),
|
||||
('Pozzi, Samuel-Jean.'),('Pozzo, A.'),('Pozzoli, Serge.');
|
||||
SELECT * FROM t1 WHERE autor LIKE 'Poz%' ORDER BY autor;
|
||||
autor
|
||||
Pozzi, S(amuel-Jean).
|
||||
Pozzi, Samuel-Jean.
|
||||
Pozzo, A.
|
||||
Pozzoli, Serge.
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
s1 CHAR(5) CHARACTER SET latin1 COLLATE latin1_german2_ci
|
||||
);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`s1` char(5) COLLATE latin1_german2_ci DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci
|
||||
INSERT INTO t1 VALUES ('Ü');
|
||||
INSERT INTO t1 VALUES ('ue');
|
||||
SELECT DISTINCT s1 FROM t1;
|
||||
s1
|
||||
Ü
|
||||
SELECT s1,COUNT(*) FROM t1 GROUP BY s1;
|
||||
s1 COUNT(*)
|
||||
Ü 2
|
||||
SELECT COUNT(DISTINCT s1) FROM t1;
|
||||
COUNT(DISTINCT s1)
|
||||
1
|
||||
SELECT FIELD('ue',s1), FIELD('Ü',s1), s1='ue', s1='Ü' FROM t1;
|
||||
FIELD('ue',s1) FIELD('Ü',s1) s1='ue' s1='Ü'
|
||||
1 1 1 1
|
||||
1 1 1 1
|
||||
DROP TABLE t1;
|
||||
create table t1 select repeat('a',4000) a;
|
||||
delete from t1;
|
||||
insert into t1 values ('a'), ('a '), ('a\t');
|
||||
select collation(a),hex(a) from t1 order by a;
|
||||
collation(a) hex(a)
|
||||
latin1_german2_ci 6109
|
||||
latin1_german2_ci 61
|
||||
latin1_german2_ci 6120
|
||||
drop table t1;
|
||||
drop table if exists t1;
|
||||
create table t1 as select repeat(' ', 64) as s1;
|
||||
select collation(s1) from t1;
|
||||
collation(s1)
|
||||
latin1_german2_ci
|
||||
delete from t1;
|
||||
insert into t1 values ('a'),('ae'),(_latin1 0xE4);
|
||||
insert into t1 values ('o'),('oe'),(_latin1 0xF6);
|
||||
insert into t1 values ('s'),('ss'),(_latin1 0xDF);
|
||||
insert into t1 values ('u'),('ue'),(_latin1 0xFC);
|
||||
select s1, hex(s1) from t1 order by s1, binary s1;
|
||||
s1 hex(s1)
|
||||
a 61
|
||||
ae 6165
|
||||
ä E4
|
||||
o 6F
|
||||
oe 6F65
|
||||
ö F6
|
||||
s 73
|
||||
ss 7373
|
||||
ß DF
|
||||
u 75
|
||||
ue 7565
|
||||
ü FC
|
||||
select group_concat(s1 order by binary s1) from t1 group by s1;
|
||||
group_concat(s1 order by binary s1)
|
||||
a
|
||||
ae,ä
|
||||
o
|
||||
oe,ö
|
||||
s
|
||||
ss,ß
|
||||
u
|
||||
ue,ü
|
||||
drop table t1;
|
||||
SET NAMES latin1;
|
||||
CREATE TABLE t1 (
|
||||
col1 varchar(255) NOT NULL default ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 collate latin1_german2_ci;
|
||||
INSERT INTO t1 VALUES ('ß'),('ss'),('ss');
|
||||
ALTER TABLE t1 ADD KEY ifword(col1);
|
||||
SELECT * FROM t1 WHERE col1='ß' ORDER BY col1, BINARY col1;
|
||||
col1
|
||||
ss
|
||||
ss
|
||||
ß
|
||||
DROP TABLE t1;
|
||||
create table t1 (s1 char(5) character set latin1 collate latin1_german2_ci);
|
||||
insert into t1 values (0xf6) /* this is o-umlaut */;
|
||||
select * from t1 where length(s1)=1 and s1='oe';
|
||||
s1
|
||||
ö
|
||||
drop table t1;
|
||||
383
build/lib/mysql/mysql-test/r/ctype_latin2.result
Normal file
383
build/lib/mysql/mysql-test/r/ctype_latin2.result
Normal file
@@ -0,0 +1,383 @@
|
||||
drop table if exists t1;
|
||||
SET NAMES latin2;
|
||||
CREATE TABLE t1 (a char(1) character set latin2);
|
||||
INSERT INTO t1 VALUES (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27);
|
||||
INSERT INTO t1 VALUES (0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
|
||||
INSERT INTO t1 VALUES (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37);
|
||||
INSERT INTO t1 VALUES (0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
|
||||
INSERT INTO t1 VALUES (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47);
|
||||
INSERT INTO t1 VALUES (0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
|
||||
INSERT INTO t1 VALUES (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57);
|
||||
INSERT INTO t1 VALUES (0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
|
||||
INSERT INTO t1 VALUES (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67);
|
||||
INSERT INTO t1 VALUES (0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
|
||||
INSERT INTO t1 VALUES (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77);
|
||||
INSERT INTO t1 VALUES (0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
|
||||
INSERT INTO t1 VALUES (0x80),(0x81),(0x82),(0x83),(0x84),(0x85),(0x86),(0x87);
|
||||
INSERT INTO t1 VALUES (0x88),(0x89),(0x8A),(0x8B),(0x8C),(0x8D),(0x8E),(0x8F);
|
||||
INSERT INTO t1 VALUES (0x90),(0x91),(0x92),(0x93),(0x94),(0x95),(0x96),(0x97);
|
||||
INSERT INTO t1 VALUES (0x98),(0x99),(0x9A),(0x9B),(0x9C),(0x9D),(0x9E),(0x9F);
|
||||
INSERT INTO t1 VALUES (0xA0),(0xA1),(0xA2),(0xA3),(0xA4),(0xA5),(0xA6),(0xA7);
|
||||
INSERT INTO t1 VALUES (0xA8),(0xA9),(0xAA),(0xAB),(0xAC),(0xAD),(0xAE),(0xAF);
|
||||
INSERT INTO t1 VALUES (0xB0),(0xB1),(0xB2),(0xB3),(0xB4),(0xB5),(0xB6),(0xB7);
|
||||
INSERT INTO t1 VALUES (0xB8),(0xB9),(0xBA),(0xBB),(0xBC),(0xBD),(0xBE),(0xBF);
|
||||
INSERT INTO t1 VALUES (0xC0),(0xC1),(0xC2),(0xC3),(0xC4),(0xC5),(0xC6),(0xC7);
|
||||
INSERT INTO t1 VALUES (0xC8),(0xC9),(0xCA),(0xCB),(0xCC),(0xCD),(0xCE),(0xCF);
|
||||
INSERT INTO t1 VALUES (0xD0),(0xD1),(0xD2),(0xD3),(0xD4),(0xD5),(0xD6),(0xD7);
|
||||
INSERT INTO t1 VALUES (0xD8),(0xD9),(0xDA),(0xDB),(0xDC),(0xDD),(0xDE),(0xDF);
|
||||
INSERT INTO t1 VALUES (0xE0),(0xE1),(0xE2),(0xE3),(0xE4),(0xE5),(0xE6),(0xE7);
|
||||
INSERT INTO t1 VALUES (0xE8),(0xE9),(0xEA),(0xEB),(0xEC),(0xED),(0xEE),(0xEF);
|
||||
INSERT INTO t1 VALUES (0xF0),(0xF1),(0xF2),(0xF3),(0xF4),(0xF5),(0xF6),(0xF7);
|
||||
INSERT INTO t1 VALUES (0xF8),(0xF9),(0xFA),(0xFB),(0xFC),(0xFD),(0xFE),(0xFF);
|
||||
SELECT hex(a) ha, hex(lower(a)) hl, hex(upper(a)) hu,
|
||||
a, lower(a) l, upper(a) u from t1 order by ha;
|
||||
ha hl hu a l u
|
||||
|
||||
21 21 21 ! ! !
|
||||
22 22 22 " " "
|
||||
23 23 23 # # #
|
||||
24 24 24 $ $ $
|
||||
25 25 25 % % %
|
||||
26 26 26 & & &
|
||||
27 27 27 ' ' '
|
||||
28 28 28 ( ( (
|
||||
29 29 29 ) ) )
|
||||
2A 2A 2A * * *
|
||||
2B 2B 2B + + +
|
||||
2C 2C 2C , , ,
|
||||
2D 2D 2D - - -
|
||||
2E 2E 2E . . .
|
||||
2F 2F 2F / / /
|
||||
30 30 30 0 0 0
|
||||
31 31 31 1 1 1
|
||||
32 32 32 2 2 2
|
||||
33 33 33 3 3 3
|
||||
34 34 34 4 4 4
|
||||
35 35 35 5 5 5
|
||||
36 36 36 6 6 6
|
||||
37 37 37 7 7 7
|
||||
38 38 38 8 8 8
|
||||
39 39 39 9 9 9
|
||||
3A 3A 3A : : :
|
||||
3B 3B 3B ; ; ;
|
||||
3C 3C 3C < < <
|
||||
3D 3D 3D = = =
|
||||
3E 3E 3E > > >
|
||||
3F 3F 3F ? ? ?
|
||||
40 40 40 @ @ @
|
||||
41 61 41 A a A
|
||||
42 62 42 B b B
|
||||
43 63 43 C c C
|
||||
44 64 44 D d D
|
||||
45 65 45 E e E
|
||||
46 66 46 F f F
|
||||
47 67 47 G g G
|
||||
48 68 48 H h H
|
||||
49 69 49 I i I
|
||||
4A 6A 4A J j J
|
||||
4B 6B 4B K k K
|
||||
4C 6C 4C L l L
|
||||
4D 6D 4D M m M
|
||||
4E 6E 4E N n N
|
||||
4F 6F 4F O o O
|
||||
50 70 50 P p P
|
||||
51 71 51 Q q Q
|
||||
52 72 52 R r R
|
||||
53 73 53 S s S
|
||||
54 74 54 T t T
|
||||
55 75 55 U u U
|
||||
56 76 56 V v V
|
||||
57 77 57 W w W
|
||||
58 78 58 X x X
|
||||
59 79 59 Y y Y
|
||||
5A 7A 5A Z z Z
|
||||
5B 5B 5B [ [ [
|
||||
5C 5C 5C \ \ \
|
||||
5D 5D 5D ] ] ]
|
||||
5E 5E 5E ^ ^ ^
|
||||
5F 5F 5F _ _ _
|
||||
60 60 60 ` ` `
|
||||
61 61 41 a a A
|
||||
62 62 42 b b B
|
||||
63 63 43 c c C
|
||||
64 64 44 d d D
|
||||
65 65 45 e e E
|
||||
66 66 46 f f F
|
||||
67 67 47 g g G
|
||||
68 68 48 h h H
|
||||
69 69 49 i i I
|
||||
6A 6A 4A j j J
|
||||
6B 6B 4B k k K
|
||||
6C 6C 4C l l L
|
||||
6D 6D 4D m m M
|
||||
6E 6E 4E n n N
|
||||
6F 6F 4F o o O
|
||||
70 70 50 p p P
|
||||
71 71 51 q q Q
|
||||
72 72 52 r r R
|
||||
73 73 53 s s S
|
||||
74 74 54 t t T
|
||||
75 75 55 u u U
|
||||
76 76 56 v v V
|
||||
77 77 57 w w W
|
||||
78 78 58 x x X
|
||||
79 79 59 y y Y
|
||||
7A 7A 5A z z Z
|
||||
7B 7B 7B { { {
|
||||
7C 7C 7C | | |
|
||||
7D 7D 7D } } }
|
||||
7E 7E 7E ~ ~ ~
|
||||
7F 7F 7F
|
||||
80 80 80 € € €
|
||||
81 81 81 <09> <09> <09>
|
||||
82 82 82 ‚ ‚ ‚
|
||||
83 83 83 ƒ ƒ ƒ
|
||||
84 84 84 „ „ „
|
||||
85 85 85 … … …
|
||||
86 86 86 † † †
|
||||
87 87 87 ‡ ‡ ‡
|
||||
88 88 88 ˆ ˆ ˆ
|
||||
89 89 89 ‰ ‰ ‰
|
||||
8A 8A 8A Š Š Š
|
||||
8B 8B 8B ‹ ‹ ‹
|
||||
8C 8C 8C Œ Œ Œ
|
||||
8D 8D 8D <09> <09> <09>
|
||||
8E 8E 8E Ž Ž Ž
|
||||
8F 8F 8F <09> <09> <09>
|
||||
90 90 90 <09> <09> <09>
|
||||
91 91 91 ‘ ‘ ‘
|
||||
92 92 92 ’ ’ ’
|
||||
93 93 93 “ “ “
|
||||
94 94 94 ” ” ”
|
||||
95 95 95 • • •
|
||||
96 96 96 – – –
|
||||
97 97 97 — — —
|
||||
98 98 98 ˜ ˜ ˜
|
||||
99 99 99 ™ ™ ™
|
||||
9A 9A 9A š š š
|
||||
9B 9B 9B › › ›
|
||||
9C 9C 9C œ œ œ
|
||||
9D 9D 9D <09> <09> <09>
|
||||
9E 9E 9E ž ž ž
|
||||
9F 9F 9F Ÿ Ÿ Ÿ
|
||||
A0 A0 A0
|
||||
A1 B1 A1 ¡ ± ¡
|
||||
A2 A2 A2 ¢ ¢ ¢
|
||||
A3 B3 A3 £ ³ £
|
||||
A4 A4 A4 ¤ ¤ ¤
|
||||
A5 B5 A5 ¥ µ ¥
|
||||
A6 B6 A6 ¦ ¶ ¦
|
||||
A7 A7 A7 § § §
|
||||
A8 A8 A8 ¨ ¨ ¨
|
||||
A9 B9 A9 © ¹ ©
|
||||
AA BA AA ª º ª
|
||||
AB BB AB « » «
|
||||
AC BC AC ¬ ¼ ¬
|
||||
AD AD AD
|
||||
AE BE AE ® ¾ ®
|
||||
AF BF AF ¯ ¿ ¯
|
||||
B0 B0 B0 ° ° °
|
||||
B1 B1 A1 ± ± ¡
|
||||
B2 B2 B2 ² ² ²
|
||||
B3 B3 A3 ³ ³ £
|
||||
B4 B4 B4 ´ ´ ´
|
||||
B5 B5 A5 µ µ ¥
|
||||
B6 B6 A6 ¶ ¶ ¦
|
||||
B7 B7 B7 · · ·
|
||||
B8 B8 B8 ¸ ¸ ¸
|
||||
B9 B9 A9 ¹ ¹ ©
|
||||
BA BA AA º º ª
|
||||
BB BB AB » » «
|
||||
BC BC AC ¼ ¼ ¬
|
||||
BD BD BD ½ ½ ½
|
||||
BE BE AE ¾ ¾ ®
|
||||
BF BF AF ¿ ¿ ¯
|
||||
C0 E0 C0 À à À
|
||||
C1 E1 C1 Á á Á
|
||||
C2 E2 C2 Â â Â
|
||||
C3 E3 C3 Ã ã Ã
|
||||
C4 E4 C4 Ä ä Ä
|
||||
C5 E5 C5 Å å Å
|
||||
C6 E6 C6 Æ æ Æ
|
||||
C7 E7 C7 Ç ç Ç
|
||||
C8 E8 C8 È è È
|
||||
C9 E9 C9 É é É
|
||||
CA EA CA Ê ê Ê
|
||||
CB EB CB Ë ë Ë
|
||||
CC EC CC Ì ì Ì
|
||||
CD ED CD Í í Í
|
||||
CE EE CE Î î Î
|
||||
CF EF CF Ï ï Ï
|
||||
D0 F0 D0 Ð ð Ð
|
||||
D1 F1 D1 Ñ ñ Ñ
|
||||
D2 F2 D2 Ò ò Ò
|
||||
D3 F3 D3 Ó ó Ó
|
||||
D4 F4 D4 Ô ô Ô
|
||||
D5 F5 D5 Õ õ Õ
|
||||
D6 F6 D6 Ö ö Ö
|
||||
D7 D7 D7 × × ×
|
||||
D8 F8 D8 Ø ø Ø
|
||||
D9 F9 D9 Ù ù Ù
|
||||
DA FA DA Ú ú Ú
|
||||
DB FB DB Û û Û
|
||||
DC FC DC Ü ü Ü
|
||||
DD FD DD Ý ý Ý
|
||||
DE FE DE Þ þ Þ
|
||||
DF DF DF ß ß ß
|
||||
E0 E0 C0 à à À
|
||||
E1 E1 C1 á á Á
|
||||
E2 E2 C2 â â Â
|
||||
E3 E3 C3 ã ã Ã
|
||||
E4 E4 C4 ä ä Ä
|
||||
E5 E5 C5 å å Å
|
||||
E6 E6 C6 æ æ Æ
|
||||
E7 E7 C7 ç ç Ç
|
||||
E8 E8 C8 è è È
|
||||
E9 E9 C9 é é É
|
||||
EA EA CA ê ê Ê
|
||||
EB EB CB ë ë Ë
|
||||
EC EC CC ì ì Ì
|
||||
ED ED CD í í Í
|
||||
EE EE CE î î Î
|
||||
EF EF CF ï ï Ï
|
||||
F0 F0 D0 ð ð Ð
|
||||
F1 F1 D1 ñ ñ Ñ
|
||||
F2 F2 D2 ò ò Ò
|
||||
F3 F3 D3 ó ó Ó
|
||||
F4 F4 D4 ô ô Ô
|
||||
F5 F5 D5 õ õ Õ
|
||||
F6 F6 D6 ö ö Ö
|
||||
F7 F7 F7 ÷ ÷ ÷
|
||||
F8 F8 D8 ø ø Ø
|
||||
F9 F9 D9 ù ù Ù
|
||||
FA FA DA ú ú Ú
|
||||
FB FB DB û û Û
|
||||
FC FC DC ü ü Ü
|
||||
FD FD DD ý ý Ý
|
||||
FE FE DE þ þ Þ
|
||||
FF FF FF ÿ ÿ ÿ
|
||||
SELECT group_concat(a collate latin2_croatian_ci order by binary a) from t1 group by a collate latin2_croatian_ci;
|
||||
group_concat(a collate latin2_croatian_ci order by binary a)
|
||||
|
||||
!
|
||||
"
|
||||
#
|
||||
$
|
||||
%
|
||||
&
|
||||
'
|
||||
(
|
||||
)
|
||||
*
|
||||
+
|
||||
,
|
||||
-
|
||||
.
|
||||
/
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
:
|
||||
;
|
||||
<
|
||||
=
|
||||
>
|
||||
?
|
||||
@
|
||||
A,a,¡,±,Á,Â,Ã,Ä,á,â,ã,ä
|
||||
B,b
|
||||
C,c,Ç,ç
|
||||
È,è
|
||||
Æ,æ
|
||||
D,d,Ï,ï
|
||||
Ð,ð
|
||||
E,e,É,Ê,Ë,Ì,é,ê,ë,ì
|
||||
F,f
|
||||
G,g
|
||||
H,h
|
||||
I,i,Í,Î,í,î
|
||||
J,j
|
||||
K,k
|
||||
L,l,£,¥,³,µ,Å,å
|
||||
M,m
|
||||
N,n,Ñ,Ò,ñ,ò
|
||||
O,o,Ó,Ô,Õ,Ö,ó,ô,õ,ö
|
||||
P,p
|
||||
Q,q
|
||||
R,r,À,Ø,à,ø
|
||||
S,s,¦,ª,¶,º,ß
|
||||
©,¹
|
||||
T,t,«,»,Þ,þ
|
||||
U,u,Ù,Ú,Û,Ü,ù,ú,û,ü
|
||||
V,v
|
||||
W,w
|
||||
X,x
|
||||
Y,y,Ý,ý
|
||||
Z,z,¬,¯,¼,¿
|
||||
®,¾
|
||||
[
|
||||
\
|
||||
]
|
||||
^
|
||||
_
|
||||
`
|
||||
{
|
||||
|
|
||||
}
|
||||
~
|
||||
|
||||
€
|
||||
<EFBFBD>
|
||||
‚
|
||||
ƒ
|
||||
„
|
||||
…
|
||||
†
|
||||
‡
|
||||
ˆ
|
||||
‰
|
||||
Š
|
||||
‹
|
||||
Œ
|
||||
<EFBFBD>
|
||||
Ž
|
||||
<EFBFBD>
|
||||
<EFBFBD>
|
||||
‘
|
||||
’
|
||||
“
|
||||
”
|
||||
•
|
||||
–
|
||||
—
|
||||
˜
|
||||
™
|
||||
š
|
||||
›
|
||||
œ
|
||||
<EFBFBD>
|
||||
ž
|
||||
Ÿ
|
||||
|
||||
¢
|
||||
¤
|
||||
§
|
||||
¨
|
||||
|
||||
°
|
||||
²
|
||||
´
|
||||
·
|
||||
¸
|
||||
½
|
||||
×
|
||||
÷
|
||||
ÿ
|
||||
drop table t1;
|
||||
31
build/lib/mysql/mysql-test/r/ctype_latin2_ch.result
Normal file
31
build/lib/mysql/mysql-test/r/ctype_latin2_ch.result
Normal file
@@ -0,0 +1,31 @@
|
||||
drop table if exists t1;
|
||||
set names latin2;
|
||||
select 'A' = 'a' collate latin2_czech_cs;
|
||||
'A' = 'a' collate latin2_czech_cs
|
||||
0
|
||||
create table t1 (
|
||||
id int(5) not null,
|
||||
tt char(255) not null
|
||||
) character set latin2 collate latin2_czech_cs;
|
||||
insert into t1 values (1,'Aa');
|
||||
insert into t1 values (2,'Aas');
|
||||
alter table t1 add primary key aaa(tt);
|
||||
select * from t1 where tt like 'Aa%';
|
||||
id tt
|
||||
1 Aa
|
||||
2 Aas
|
||||
select * from t1 ignore index (primary) where tt like 'Aa%';
|
||||
id tt
|
||||
1 Aa
|
||||
2 Aas
|
||||
select * from t1 where tt like '%Aa%';
|
||||
id tt
|
||||
1 Aa
|
||||
2 Aas
|
||||
select * from t1 where tt like 'AA%';
|
||||
id tt
|
||||
select * from t1 ignore index (primary) where tt like 'AA%';
|
||||
id tt
|
||||
select * from t1 where tt like '%AA%';
|
||||
id tt
|
||||
drop table t1;
|
||||
348
build/lib/mysql/mysql-test/r/ctype_ldml.result
Normal file
348
build/lib/mysql/mysql-test/r/ctype_ldml.result
Normal file
@@ -0,0 +1,348 @@
|
||||
drop table if exists t1;
|
||||
set names utf8;
|
||||
show variables like 'character_sets_dir%';
|
||||
Variable_name Value
|
||||
character_sets_dir MYSQL_TEST_DIR/std_data/
|
||||
show collation like 'utf8_test_ci';
|
||||
Collation Charset Id Default Compiled Sortlen
|
||||
utf8_test_ci utf8 240 8
|
||||
create table t1 (c1 char(1) character set utf8 collate utf8_test_ci);
|
||||
insert into t1 values ('a');
|
||||
select * from t1 where c1='b';
|
||||
c1
|
||||
a
|
||||
drop table t1;
|
||||
show collation like 'ucs2_test_ci';
|
||||
Collation Charset Id Default Compiled Sortlen
|
||||
ucs2_test_ci ucs2 241 8
|
||||
create table t1 (c1 char(1) character set ucs2 collate ucs2_test_ci);
|
||||
insert into t1 values ('a');
|
||||
select * from t1 where c1='b';
|
||||
c1
|
||||
a
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
col1 varchar(100) character set utf8 collate utf8_test_ci
|
||||
);
|
||||
INSERT INTO t1 (col1) VALUES ('abcd'),('efgh'),('ijkl');
|
||||
ALTER TABLE t1 ADD FULLTEXT INDEX (col1);
|
||||
SELECT * FROM t1 where match (col1) against ('abcd');
|
||||
col1
|
||||
abcd
|
||||
SELECT * FROM t1 where match (col1) against ('abcd' IN BOOLEAN MODE);
|
||||
col1
|
||||
abcd
|
||||
ALTER TABLE t1 ADD (col2 varchar(100) character set latin1);
|
||||
UPDATE t1 SET col2=col1;
|
||||
SELECT * FROM t1 WHERE col1=col2 ORDER BY col1;
|
||||
col1 col2
|
||||
abcd abcd
|
||||
efgh efgh
|
||||
ijkl ijkl
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#45645 Mysql server close all connection and restart using lower function
|
||||
#
|
||||
CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET utf8 COLLATE utf8_test_ci;
|
||||
INSERT INTO t1 (a) VALUES ('hello!');
|
||||
SELECT * FROM t1 WHERE LOWER(a)=LOWER('N');
|
||||
a
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#51976 LDML collations issue (cyrillic example)
|
||||
#
|
||||
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_test_ci);
|
||||
INSERT INTO t1 (a) VALUES ('Hello');
|
||||
SELECT a, UPPER(a), LOWER(a) FROM t1;
|
||||
a UPPER(a) LOWER(a)
|
||||
Hello HELLO hello
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#43827 Server closes connections and restarts
|
||||
#
|
||||
CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_test_ci);
|
||||
INSERT INTO t1 SELECT REPEAT('a',11);
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'c1' at row 1
|
||||
DROP TABLE t1;
|
||||
show collation like 'ucs2_vn_ci';
|
||||
Collation Charset Id Default Compiled Sortlen
|
||||
ucs2_vn_ci ucs2 242 8
|
||||
create table t1 (c1 char(1) character set ucs2 collate ucs2_vn_ci);
|
||||
insert into t1 values (0x0061),(0x0041),(0x00E0),(0x00C0),(0x1EA3),(0x1EA2),
|
||||
(0x00E3),(0x00C3),(0x00E1),(0x00C1),(0x1EA1),(0x1EA0);
|
||||
insert into t1 values (0x0103),(0x0102),(0x1EB1),(0x1EB0),(0x1EB3),(0x1EB2),
|
||||
(0x1EB5),(0x1EB4),(0x1EAF),(0x1EAE),(0x1EB7),(0x1EB6);
|
||||
insert into t1 values (0x00E2),(0x00C2),(0x1EA7),(0x1EA6),(0x1EA9),(0x1EA8),
|
||||
(0x1EAB),(0x1EAA),(0x1EA5),(0x1EA4),(0x1EAD),(0x1EAC);
|
||||
insert into t1 values ('b'),('B'),('c'),('C');
|
||||
insert into t1 values ('d'),('D'),(0x0111),(0x0110);
|
||||
insert into t1 values (0x0065),(0x0045),(0x00E8),(0x00C8),(0x1EBB),(0x1EBA),
|
||||
(0x1EBD),(0x1EBC),(0x00E9),(0x00C9),(0x1EB9),(0x1EB8);
|
||||
insert into t1 values (0x00EA),(0x00CA),(0x1EC1),(0x1EC0),(0x1EC3),(0x1EC2),
|
||||
(0x1EC5),(0x1EC4),(0x1EBF),(0x1EBE),(0x1EC7),(0x1EC6);
|
||||
insert into t1 values ('g'),('G'),('h'),('H');
|
||||
insert into t1 values (0x0069),(0x0049),(0x00EC),(0x00CC),(0x1EC9),(0x1EC8),
|
||||
(0x0129),(0x0128),(0x00ED),(0x00CD),(0x1ECB),(0x1ECA);
|
||||
insert into t1 values ('k'),('K'),('l'),('L'),('m'),('M');
|
||||
insert into t1 values (0x006F),(0x004F),(0x00F2),(0x00D2),(0x1ECF),(0x1ECE),
|
||||
(0x00F5),(0x00D5),(0x00F3),(0x00D3),(0x1ECD),(0x1ECC);
|
||||
insert into t1 values (0x00F4),(0x00D4),(0x1ED3),(0x1ED2),(0x1ED5),(0x1ED4),
|
||||
(0x1ED7),(0x1ED6),(0x1ED1),(0x1ED0),(0x1ED9),(0x1ED8);
|
||||
insert into t1 values (0x01A1),(0x01A0),(0x1EDD),(0x1EDC),(0x1EDF),(0x1EDE),
|
||||
(0x1EE1),(0x1EE0),(0x1EDB),(0x1EDA),(0x1EE3),(0x1EE2);
|
||||
insert into t1 values ('p'),('P'),('q'),('Q'),('r'),('R'),('s'),('S'),('t'),('T');
|
||||
insert into t1 values (0x0075),(0x0055),(0x00F9),(0x00D9),(0x1EE7),(0x1EE6),
|
||||
(0x0169),(0x0168),(0x00FA),(0x00DA),(0x1EE5),(0x1EE4);
|
||||
insert into t1 values (0x01B0),(0x01AF),(0x1EEB),(0x1EEA),(0x1EED),(0x1EEC),
|
||||
(0x1EEF),(0x1EEE),(0x1EE9),(0x1EE8),(0x1EF1),(0x1EF0);
|
||||
insert into t1 values ('v'),('V'),('x'),('X');
|
||||
insert into t1 values (0x0079),(0x0059),(0x1EF3),(0x1EF2),(0x1EF7),(0x1EF6),
|
||||
(0x1EF9),(0x1EF8),(0x00FD),(0x00DD),(0x1EF5),(0x1EF4);
|
||||
select hex(c1) as h, c1 from t1 order by c1, h;
|
||||
h c1
|
||||
0041 A
|
||||
0061 a
|
||||
00C0 À
|
||||
00C1 Á
|
||||
00C3 Ã
|
||||
00E0 à
|
||||
00E1 á
|
||||
00E3 ã
|
||||
1EA0 Ạ
|
||||
1EA1 ạ
|
||||
1EA2 Ả
|
||||
1EA3 ả
|
||||
0102 Ă
|
||||
0103 ă
|
||||
1EAE Ắ
|
||||
1EAF ắ
|
||||
1EB0 Ằ
|
||||
1EB1 ằ
|
||||
1EB2 Ẳ
|
||||
1EB3 ẳ
|
||||
1EB4 Ẵ
|
||||
1EB5 ẵ
|
||||
1EB6 Ặ
|
||||
1EB7 ặ
|
||||
00C2 Â
|
||||
00E2 â
|
||||
1EA4 Ấ
|
||||
1EA5 ấ
|
||||
1EA6 Ầ
|
||||
1EA7 ầ
|
||||
1EA8 Ẩ
|
||||
1EA9 ẩ
|
||||
1EAA Ẫ
|
||||
1EAB ẫ
|
||||
1EAC Ậ
|
||||
1EAD ậ
|
||||
0042 B
|
||||
0062 b
|
||||
0043 C
|
||||
0063 c
|
||||
0044 D
|
||||
0064 d
|
||||
0110 Đ
|
||||
0111 đ
|
||||
0045 E
|
||||
0065 e
|
||||
00C8 È
|
||||
00C9 É
|
||||
00E8 è
|
||||
00E9 é
|
||||
1EB8 Ẹ
|
||||
1EB9 ẹ
|
||||
1EBA Ẻ
|
||||
1EBB ẻ
|
||||
1EBC Ẽ
|
||||
1EBD ẽ
|
||||
00CA Ê
|
||||
00EA ê
|
||||
1EBE Ế
|
||||
1EBF ế
|
||||
1EC0 Ề
|
||||
1EC1 ề
|
||||
1EC2 Ể
|
||||
1EC3 ể
|
||||
1EC4 Ễ
|
||||
1EC5 ễ
|
||||
1EC6 Ệ
|
||||
1EC7 ệ
|
||||
0047 G
|
||||
0067 g
|
||||
0048 H
|
||||
0068 h
|
||||
0049 I
|
||||
0069 i
|
||||
00CC Ì
|
||||
00CD Í
|
||||
00EC ì
|
||||
00ED í
|
||||
0128 Ĩ
|
||||
0129 ĩ
|
||||
1EC8 Ỉ
|
||||
1EC9 ỉ
|
||||
1ECA Ị
|
||||
1ECB ị
|
||||
004B K
|
||||
006B k
|
||||
004C L
|
||||
006C l
|
||||
004D M
|
||||
006D m
|
||||
004F O
|
||||
006F o
|
||||
00D2 Ò
|
||||
00D3 Ó
|
||||
00D5 Õ
|
||||
00F2 ò
|
||||
00F3 ó
|
||||
00F5 õ
|
||||
1ECC Ọ
|
||||
1ECD ọ
|
||||
1ECE Ỏ
|
||||
1ECF ỏ
|
||||
00D4 Ô
|
||||
00F4 ô
|
||||
1ED0 Ố
|
||||
1ED1 ố
|
||||
1ED2 Ồ
|
||||
1ED3 ồ
|
||||
1ED4 Ổ
|
||||
1ED5 ổ
|
||||
1ED6 Ỗ
|
||||
1ED7 ỗ
|
||||
1ED8 Ộ
|
||||
1ED9 ộ
|
||||
01A0 Ơ
|
||||
01A1 ơ
|
||||
1EDA Ớ
|
||||
1EDB ớ
|
||||
1EDC Ờ
|
||||
1EDD ờ
|
||||
1EDE Ở
|
||||
1EDF ở
|
||||
1EE0 Ỡ
|
||||
1EE1 ỡ
|
||||
1EE2 Ợ
|
||||
1EE3 ợ
|
||||
0050 P
|
||||
0070 p
|
||||
0051 Q
|
||||
0071 q
|
||||
0052 R
|
||||
0072 r
|
||||
0053 S
|
||||
0073 s
|
||||
0054 T
|
||||
0074 t
|
||||
0055 U
|
||||
0075 u
|
||||
00D9 Ù
|
||||
00DA Ú
|
||||
00F9 ù
|
||||
00FA ú
|
||||
0168 Ũ
|
||||
0169 ũ
|
||||
1EE4 Ụ
|
||||
1EE5 ụ
|
||||
1EE6 Ủ
|
||||
1EE7 ủ
|
||||
01AF Ư
|
||||
01B0 ư
|
||||
1EE8 Ứ
|
||||
1EE9 ứ
|
||||
1EEA Ừ
|
||||
1EEB ừ
|
||||
1EEC Ử
|
||||
1EED ử
|
||||
1EEE Ữ
|
||||
1EEF ữ
|
||||
1EF0 Ự
|
||||
1EF1 ự
|
||||
0056 V
|
||||
0076 v
|
||||
0058 X
|
||||
0078 x
|
||||
0059 Y
|
||||
0079 y
|
||||
00DD Ý
|
||||
00FD ý
|
||||
1EF2 Ỳ
|
||||
1EF3 ỳ
|
||||
1EF4 Ỵ
|
||||
1EF5 ỵ
|
||||
1EF6 Ỷ
|
||||
1EF7 ỷ
|
||||
1EF8 Ỹ
|
||||
1EF9 ỹ
|
||||
select group_concat(hex(c1) order by hex(c1)) from t1 group by c1;
|
||||
group_concat(hex(c1) order by hex(c1))
|
||||
0041,0061,00C0,00C1,00C3,00E0,00E1,00E3,1EA0,1EA1,1EA2,1EA3
|
||||
0102,0103,1EAE,1EAF,1EB0,1EB1,1EB2,1EB3,1EB4,1EB5,1EB6,1EB7
|
||||
00C2,00E2,1EA4,1EA5,1EA6,1EA7,1EA8,1EA9,1EAA,1EAB,1EAC,1EAD
|
||||
0042,0062
|
||||
0043,0063
|
||||
0044,0064
|
||||
0110,0111
|
||||
0045,0065,00C8,00C9,00E8,00E9,1EB8,1EB9,1EBA,1EBB,1EBC,1EBD
|
||||
00CA,00EA,1EBE,1EBF,1EC0,1EC1,1EC2,1EC3,1EC4,1EC5,1EC6,1EC7
|
||||
0047,0067
|
||||
0048,0068
|
||||
0049,0069,00CC,00CD,00EC,00ED,0128,0129,1EC8,1EC9,1ECA,1ECB
|
||||
004B,006B
|
||||
004C,006C
|
||||
004D,006D
|
||||
004F,006F,00D2,00D3,00D5,00F2,00F3,00F5,1ECC,1ECD,1ECE,1ECF
|
||||
00D4,00F4,1ED0,1ED1,1ED2,1ED3,1ED4,1ED5,1ED6,1ED7,1ED8,1ED9
|
||||
01A0,01A1,1EDA,1EDB,1EDC,1EDD,1EDE,1EDF,1EE0,1EE1,1EE2,1EE3
|
||||
0050,0070
|
||||
0051,0071
|
||||
0052,0072
|
||||
0053,0073
|
||||
0054,0074
|
||||
0055,0075,00D9,00DA,00F9,00FA,0168,0169,1EE4,1EE5,1EE6,1EE7
|
||||
01AF,01B0,1EE8,1EE9,1EEA,1EEB,1EEC,1EED,1EEE,1EEF,1EF0,1EF1
|
||||
0056,0076
|
||||
0058,0078
|
||||
0059,0079,00DD,00FD,1EF2,1EF3,1EF4,1EF5,1EF6,1EF7,1EF8,1EF9
|
||||
select group_concat(c1 order by hex(c1) SEPARATOR '') from t1 group by c1;
|
||||
group_concat(c1 order by hex(c1) SEPARATOR '')
|
||||
AaÀÁÃàáãẠạẢả
|
||||
ĂăẮắẰằẲẳẴẵẶặ
|
||||
ÂâẤấẦầẨẩẪẫẬậ
|
||||
Bb
|
||||
Cc
|
||||
Dd
|
||||
Đđ
|
||||
EeÈÉèéẸẹẺẻẼẽ
|
||||
ÊêẾếỀềỂểỄễỆệ
|
||||
Gg
|
||||
Hh
|
||||
IiÌÍìíĨĩỈỉỊị
|
||||
Kk
|
||||
Ll
|
||||
Mm
|
||||
OoÒÓÕòóõỌọỎỏ
|
||||
ÔôỐốỒồỔổỖỗỘộ
|
||||
ƠơỚớỜờỞởỠỡỢợ
|
||||
Pp
|
||||
Qq
|
||||
Rr
|
||||
Ss
|
||||
Tt
|
||||
UuÙÚùúŨũỤụỦủ
|
||||
ƯưỨứỪừỬửỮữỰự
|
||||
Vv
|
||||
Xx
|
||||
YyÝýỲỳỴỵỶỷỸỹ
|
||||
drop table t1;
|
||||
Bug#46448 trailing spaces are not ignored when user collation maps space != 0x20
|
||||
set names latin1;
|
||||
show collation like 'latin1_test';
|
||||
Collation Charset Id Default Compiled Sortlen
|
||||
latin1_test latin1 99 Yes 1
|
||||
select "foo" = "foo " collate latin1_test;
|
||||
"foo" = "foo " collate latin1_test
|
||||
1
|
||||
1700
build/lib/mysql/mysql-test/r/ctype_many.result
Normal file
1700
build/lib/mysql/mysql-test/r/ctype_many.result
Normal file
File diff suppressed because it is too large
Load Diff
57
build/lib/mysql/mysql-test/r/ctype_mb.result
Normal file
57
build/lib/mysql/mysql-test/r/ctype_mb.result
Normal file
@@ -0,0 +1,57 @@
|
||||
drop table if exists t1;
|
||||
CREATE TABLE t1 SELECT _utf8'test' as c1, _utf8'тест' as c2;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT '',
|
||||
`c2` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DELETE FROM t1;
|
||||
ALTER TABLE t1 ADD c3 CHAR(4) CHARACTER SET utf8;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT '',
|
||||
`c2` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT '',
|
||||
`c3` char(4) CHARACTER SET utf8 DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES ('aaaabbbbccccdddd','aaaabbbbccccdddd','aaaabbbbccccdddd');
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'c1' at row 1
|
||||
Warning 1265 Data truncated for column 'c2' at row 1
|
||||
Warning 1265 Data truncated for column 'c3' at row 1
|
||||
SELECT * FROM t1;
|
||||
c1 c2 c3
|
||||
aaaa aaaa aaaa
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a CHAR(4) CHARACTER SET utf8, KEY key_a(a(3)));
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` char(4) CHARACTER SET utf8 DEFAULT NULL,
|
||||
KEY `key_a` (`a`(3))
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SHOW KEYS FROM t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 1 key_a 1 a A NULL 3 NULL YES BTREE
|
||||
ALTER TABLE t1 CHANGE a a CHAR(4);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` char(4) DEFAULT NULL,
|
||||
KEY `key_a` (`a`(3))
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SHOW KEYS FROM t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 1 key_a 1 a A NULL 3 NULL YES BTREE
|
||||
ALTER TABLE t1 CHANGE a a CHAR(4) CHARACTER SET utf8;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` char(4) CHARACTER SET utf8 DEFAULT NULL,
|
||||
KEY `key_a` (`a`(3))
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SHOW KEYS FROM t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 1 key_a 1 a A NULL 3 NULL YES BTREE
|
||||
DROP TABLE t1;
|
||||
269
build/lib/mysql/mysql-test/r/ctype_recoding.result
Normal file
269
build/lib/mysql/mysql-test/r/ctype_recoding.result
Normal file
@@ -0,0 +1,269 @@
|
||||
SET CHARACTER SET koi8r;
|
||||
DROP TABLE IF EXISTS ÔÁÂÌÉÃÁ, t1, t2;
|
||||
SET CHARACTER SET koi8r;
|
||||
CREATE TABLE t1 (a CHAR(10) CHARACTER SET cp1251) SELECT _koi8r'ÐÒÏÂÁ' AS a;
|
||||
CREATE TABLE t2 (a CHAR(10) CHARACTER SET utf8);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` char(10) CHARACTER SET cp1251 DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT a FROM t1;
|
||||
a
|
||||
ÐÒÏÂÁ
|
||||
SELECT HEX(a) FROM t1;
|
||||
HEX(a)
|
||||
EFF0EEE1E0
|
||||
INSERT t2 SELECT * FROM t1;
|
||||
SELECT HEX(a) FROM t2;
|
||||
HEX(a)
|
||||
D0BFD180D0BED0B1D0B0
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t1 (description text character set cp1250 NOT NULL);
|
||||
INSERT INTO t1 (description) VALUES (_latin2'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddde');
|
||||
SELECT description FROM t1;
|
||||
description
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddde
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a TEXT CHARACTER SET cp1251) SELECT _koi8r'ÐÒÏÂÁ' AS a;
|
||||
CREATE TABLE t2 (a TEXT CHARACTER SET utf8);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` text CHARACTER SET cp1251
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SELECT HEX(a) FROM t1;
|
||||
HEX(a)
|
||||
EFF0EEE1E0
|
||||
INSERT t2 SELECT * FROM t1;
|
||||
SELECT HEX(a) FROM t2;
|
||||
HEX(a)
|
||||
D0BFD180D0BED0B1D0B0
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE `ÔÁÂÌÉÃÁ`
|
||||
(
|
||||
ÐÏÌÅ CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT "ËÏÍÍÅÎÔÁÒÉÊ ÐÏÌÑ"
|
||||
) COMMENT "ËÏÍÍÅÎÔÁÒÉÊ ÔÁÂÌÉÃÙ";
|
||||
SHOW TABLES;
|
||||
Tables_in_test
|
||||
ÔÁÂÌÉÃÁ
|
||||
SHOW CREATE TABLE ÔÁÂÌÉÃÁ;
|
||||
Table Create Table
|
||||
ÔÁÂÌÉÃÁ CREATE TABLE `ÔÁÂÌÉÃÁ` (
|
||||
`ÐÏÌÅ` char(32) CHARACTER SET koi8r NOT NULL COMMENT 'ËÏÍÍÅÎÔÁÒÉÊ ÐÏÌÑ'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='ËÏÍÍÅÎÔÁÒÉÊ ÔÁÂÌÉÃÙ'
|
||||
SHOW FIELDS FROM ÔÁÂÌÉÃÁ;
|
||||
Field Type Null Key Default Extra
|
||||
ÐÏÌÅ char(32) NO NULL
|
||||
SET CHARACTER SET cp1251;
|
||||
SHOW TABLES;
|
||||
Tables_in_test
|
||||
òàáëèöà
|
||||
SHOW CREATE TABLE òàáëèöà;
|
||||
Table Create Table
|
||||
òàáëèöà CREATE TABLE `òàáëèöà` (
|
||||
`ïîëå` char(32) CHARACTER SET koi8r NOT NULL COMMENT 'êîììåíòàðèé ïîëÿ'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='êîììåíòàðèé òàáëèöû'
|
||||
SHOW FIELDS FROM òàáëèöà;
|
||||
Field Type Null Key Default Extra
|
||||
ïîëå char(32) NO NULL
|
||||
SET CHARACTER SET utf8;
|
||||
SHOW TABLES;
|
||||
Tables_in_test
|
||||
таблица
|
||||
SHOW CREATE TABLE таблица;
|
||||
Table Create Table
|
||||
таблица CREATE TABLE `таблица` (
|
||||
`поле` char(32) CHARACTER SET koi8r NOT NULL COMMENT 'комментарий полÑ<C2BB>'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='комментарий таблицы'
|
||||
SHOW FIELDS FROM таблица;
|
||||
Field Type Null Key Default Extra
|
||||
поле char(32) NO NULL
|
||||
SET CHARACTER SET koi8r;
|
||||
DROP TABLE ÔÁÂÌÉÃÁ;
|
||||
SET CHARACTER SET default;
|
||||
SET NAMES UTF8;
|
||||
CREATE TABLE t1 (t text) DEFAULT CHARSET UTF8;
|
||||
INSERT INTO t1 (t) VALUES ('x');
|
||||
SELECT 1 FROM t1 WHERE CONCAT(_latin1'x') = t;
|
||||
1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
SET CHARACTER SET koi8r;
|
||||
CREATE DATABASE ÔÅÓÔ;
|
||||
USE ÔÅÓÔ;
|
||||
SHOW TABLES;
|
||||
Tables_in_ÔÅÓÔ
|
||||
SHOW TABLES IN ÔÅÓÔ;
|
||||
Tables_in_ÔÅÓÔ
|
||||
SET CHARACTER SET cp1251;
|
||||
SHOW TABLES;
|
||||
Tables_in_òåñò
|
||||
SHOW TABLES IN òåñò;
|
||||
Tables_in_òåñò
|
||||
SET CHARACTER SET koi8r;
|
||||
DROP DATABASE ÔÅÓÔ;
|
||||
SET NAMES koi8r;
|
||||
SELECT hex('ÔÅÓÔ');
|
||||
hex('ÔÅÓÔ')
|
||||
D4C5D3D4
|
||||
SET character_set_connection=cp1251;
|
||||
SELECT hex('ÔÅÓÔ');
|
||||
hex('ÔÅÓÔ')
|
||||
F2E5F1F2
|
||||
USE test;
|
||||
SET NAMES binary;
|
||||
CREATE TABLE `теÑ<C2B5>Ñ‚` (`теÑ<C2B5>Ñ‚` int);
|
||||
SHOW CREATE TABLE `теÑ<C2B5>Ñ‚`;
|
||||
Table Create Table
|
||||
теÑ<EFBFBD>Ñ‚ CREATE TABLE `теÑ<C2B5>Ñ‚` (
|
||||
`теÑ<C2B5>Ñ‚` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SET NAMES utf8;
|
||||
SHOW CREATE TABLE `теÑ<C2B5>Ñ‚`;
|
||||
Table Create Table
|
||||
теÑ<EFBFBD>Ñ‚ CREATE TABLE `теÑ<C2B5>Ñ‚` (
|
||||
`теÑ<C2B5>Ñ‚` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE `теÑ<C2B5>Ñ‚`;
|
||||
SET NAMES binary;
|
||||
SET character_set_connection=utf8;
|
||||
SELECT 'теÑ<C2B5>Ñ‚' as s;
|
||||
s
|
||||
теÑ<EFBFBD>Ñ‚
|
||||
SET NAMES utf8;
|
||||
SET character_set_connection=binary;
|
||||
SELECT 'теÑ<C2B5>Ñ‚' as s;
|
||||
s
|
||||
теÑ<EFBFBD>Ñ‚
|
||||
SET NAMES latin1;
|
||||
CREATE TABLE t1 (`ä` CHAR(128) DEFAULT 'ä', `ä1` ENUM('ä1','ä2') DEFAULT 'ä2');
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`ä` char(128) DEFAULT 'ä',
|
||||
`ä1` enum('ä1','ä2') DEFAULT 'ä2'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SHOW COLUMNS FROM t1;
|
||||
Field Type Null Key Default Extra
|
||||
ä char(128) YES ä
|
||||
ä1 enum('ä1','ä2') YES ä2
|
||||
SET NAMES binary;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`ä` char(128) DEFAULT 'ä',
|
||||
`ä1` enum('ä1','ä2') DEFAULT 'ä2'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SHOW COLUMNS FROM t1;
|
||||
Field Type Null Key Default Extra
|
||||
ä char(128) YES ä
|
||||
ä1 enum('ä1','ä2') YES ä2
|
||||
DROP TABLE t1;
|
||||
SET NAMES binary;
|
||||
CREATE TABLE `goodÐÌÏÈÏ` (a int);
|
||||
ERROR HY000: Invalid utf8 character string: 'ÐÌÏÈÏ'
|
||||
SET NAMES utf8;
|
||||
CREATE TABLE `goodÐÌÏÈÏ` (a int);
|
||||
ERROR HY000: Invalid utf8 character string: 'ÐÌÏÈÏ'
|
||||
set names latin1;
|
||||
create table t1 (a char(10) character set koi8r, b text character set koi8r);
|
||||
insert into t1 values ('test','test');
|
||||
insert into t1 values ('ÊÃÕË','ÊÃÕË');
|
||||
Warnings:
|
||||
Warning 1366 Incorrect string value: '\xCA\xC3\xD5\xCB' for column 'a' at row 1
|
||||
Warning 1366 Incorrect string value: '\xCA\xC3\xD5\xCB' for column 'b' at row 1
|
||||
drop table t1;
|
||||
set names koi8r;
|
||||
create table t1 (a char(10) character set cp1251);
|
||||
insert into t1 values (_koi8r'×ÁÓÑ');
|
||||
select * from t1 where a=_koi8r'×ÁÓÑ';
|
||||
a
|
||||
×ÁÓÑ
|
||||
select * from t1 where a=concat(_koi8r'×ÁÓÑ');
|
||||
a
|
||||
×ÁÓÑ
|
||||
select * from t1 where a=_latin1'×ÁÓÑ';
|
||||
ERROR HY000: Illegal mix of collations (cp1251_general_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation '='
|
||||
drop table t1;
|
||||
set names latin1;
|
||||
set names ascii;
|
||||
create table t1 (a char(1) character set latin1);
|
||||
insert into t1 values ('a');
|
||||
select * from t1 where a='a';
|
||||
a
|
||||
a
|
||||
drop table t1;
|
||||
set names latin1;
|
||||
create table t1 (a char(10) character set utf8 collate utf8_bin);
|
||||
insert into t1 values (' xxx');
|
||||
select * from t1 where a=lpad('xxx',10,' ');
|
||||
a
|
||||
xxx
|
||||
drop table t1;
|
||||
set names koi8r;
|
||||
create table t1 (c1 char(10) character set cp1251);
|
||||
insert into t1 values ('ß');
|
||||
select c1 from t1 where c1 between 'ß' and 'ß';
|
||||
c1
|
||||
ß
|
||||
select ifnull(c1,'ß'), ifnull(null,c1) from t1;
|
||||
ifnull(c1,'ß') ifnull(null,c1)
|
||||
ß ß
|
||||
select if(1,c1,'ö'), if(0,c1,'ö') from t1;
|
||||
if(1,c1,'ö') if(0,c1,'ö')
|
||||
ß ö
|
||||
select coalesce('ö',c1), coalesce(null,c1) from t1;
|
||||
coalesce('ö',c1) coalesce(null,c1)
|
||||
ö ß
|
||||
select least(c1,'ö'), greatest(c1,'ö') from t1;
|
||||
least(c1,'ö') greatest(c1,'ö')
|
||||
ö ß
|
||||
select locate(c1,'ß'), locate('ß',c1) from t1;
|
||||
locate(c1,'ß') locate('ß',c1)
|
||||
1 1
|
||||
select field(c1,'ß'),field('ß',c1) from t1;
|
||||
field(c1,'ß') field('ß',c1)
|
||||
1 1
|
||||
select concat(c1,'ö'), concat('ö',c1) from t1;
|
||||
concat(c1,'ö') concat('ö',c1)
|
||||
ßö öß
|
||||
select concat_ws(c1,'ö','ß'), concat_ws('ö',c1,'ß') from t1;
|
||||
concat_ws(c1,'ö','ß') concat_ws('ö',c1,'ß')
|
||||
ößß ßöß
|
||||
select replace(c1,'ß','ö'), replace('ß',c1,'ö') from t1;
|
||||
replace(c1,'ß','ö') replace('ß',c1,'ö')
|
||||
ö ö
|
||||
select substring_index(c1,'öößß',2) from t1;
|
||||
substring_index(c1,'öößß',2)
|
||||
ß
|
||||
select elt(1,c1,'ö'),elt(1,'ö',c1) from t1;
|
||||
elt(1,c1,'ö') elt(1,'ö',c1)
|
||||
ß ö
|
||||
select make_set(3,c1,'ö'), make_set(3,'ö',c1) from t1;
|
||||
make_set(3,c1,'ö') make_set(3,'ö',c1)
|
||||
ß,ö ö,ß
|
||||
select insert(c1,1,2,'ö'),insert('ö',1,2,c1) from t1;
|
||||
insert(c1,1,2,'ö') insert('ö',1,2,c1)
|
||||
ö ß
|
||||
select trim(c1 from 'ß'),trim('ß' from c1) from t1;
|
||||
trim(c1 from 'ß') trim('ß' from c1)
|
||||
|
||||
select lpad(c1,3,'ö'), lpad('ö',3,c1) from t1;
|
||||
lpad(c1,3,'ö') lpad('ö',3,c1)
|
||||
ööß ßßö
|
||||
select rpad(c1,3,'ö'), rpad('ö',3,c1) from t1;
|
||||
rpad(c1,3,'ö') rpad('ö',3,c1)
|
||||
ßöö ößß
|
||||
drop table t1;
|
||||
set names koi8r;
|
||||
create table t1(a char character set cp1251 default _koi8r 0xFF);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` char(1) CHARACTER SET cp1251 DEFAULT 'ÿ'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1(a char character set latin1 default _cp1251 0xFF);
|
||||
ERROR 42000: Invalid default value for 'a'
|
||||
End of 4.1 tests
|
||||
227
build/lib/mysql/mysql-test/r/ctype_sjis.result
Normal file
227
build/lib/mysql/mysql-test/r/ctype_sjis.result
Normal file
@@ -0,0 +1,227 @@
|
||||
drop table if exists t1;
|
||||
set names sjis;
|
||||
select 'a' like 'a';
|
||||
'a' like 'a'
|
||||
1
|
||||
select 'A' like 'a';
|
||||
'A' like 'a'
|
||||
1
|
||||
select 'A' like 'a' collate sjis_bin;
|
||||
'A' like 'a' collate sjis_bin
|
||||
0
|
||||
set @sjis1= _sjis 0xa1a2a3a4a5a6a7a8a9aaabacadaeaf;
|
||||
set @sjis2= _sjis 0xb0b1b2b3b4b5b6b7b8b9babbbcbdbebf;
|
||||
set @sjis3= _sjis 0xc0c1c2c3c4c5c6c7c8c9cacbcccdcecf;
|
||||
set @sjis4= _sjis 0xd0d1d2d3d4d5d6d7d8d9dadbdcdddedf;
|
||||
set @utf81= CONVERT(@sjis1 USING utf8);
|
||||
set @utf82= CONVERT(@sjis2 USING utf8);
|
||||
set @utf83= CONVERT(@sjis3 USING utf8);
|
||||
set @utf84= CONVERT(@sjis4 USING utf8);
|
||||
select hex(@utf81);
|
||||
hex(@utf81)
|
||||
EFBDA1EFBDA2EFBDA3EFBDA4EFBDA5EFBDA6EFBDA7EFBDA8EFBDA9EFBDAAEFBDABEFBDACEFBDADEFBDAEEFBDAF
|
||||
select hex(@utf82);
|
||||
hex(@utf82)
|
||||
EFBDB0EFBDB1EFBDB2EFBDB3EFBDB4EFBDB5EFBDB6EFBDB7EFBDB8EFBDB9EFBDBAEFBDBBEFBDBCEFBDBDEFBDBEEFBDBF
|
||||
select hex(@utf83);
|
||||
hex(@utf83)
|
||||
EFBE80EFBE81EFBE82EFBE83EFBE84EFBE85EFBE86EFBE87EFBE88EFBE89EFBE8AEFBE8BEFBE8CEFBE8DEFBE8EEFBE8F
|
||||
select hex(@utf84);
|
||||
hex(@utf84)
|
||||
EFBE90EFBE91EFBE92EFBE93EFBE94EFBE95EFBE96EFBE97EFBE98EFBE99EFBE9AEFBE9BEFBE9CEFBE9DEFBE9EEFBE9F
|
||||
select hex(CONVERT(@utf81 USING sjis));
|
||||
hex(CONVERT(@utf81 USING sjis))
|
||||
A1A2A3A4A5A6A7A8A9AAABACADAEAF
|
||||
select hex(CONVERT(@utf82 USING sjis));
|
||||
hex(CONVERT(@utf82 USING sjis))
|
||||
B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF
|
||||
select hex(CONVERT(@utf83 USING sjis));
|
||||
hex(CONVERT(@utf83 USING sjis))
|
||||
C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF
|
||||
select hex(CONVERT(@utf84 USING sjis));
|
||||
hex(CONVERT(@utf84 USING sjis))
|
||||
D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF
|
||||
create table t1 (a char(10) character set sjis);
|
||||
insert into t1 values (0x878A);
|
||||
select hex(a) from t1;
|
||||
hex(a)
|
||||
878A
|
||||
drop table t1;
|
||||
create table t1(c enum(0x9353,0x9373) character set sjis);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c` enum('鉄','都') CHARACTER SET sjis DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
insert into t1 values (0x9353);
|
||||
insert into t1 values (0x9373);
|
||||
select hex(c) from t1;
|
||||
hex(c)
|
||||
9353
|
||||
9373
|
||||
drop table t1;
|
||||
SET NAMES sjis;
|
||||
CREATE TABLE t1 (
|
||||
c char(16) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=sjis;
|
||||
insert into t1 values(0xb1),(0xb2),(0xb3);
|
||||
select hex(c) from t1;
|
||||
hex(c)
|
||||
B1
|
||||
B2
|
||||
B3
|
||||
drop table t1;
|
||||
SET collation_connection='sjis_japanese_ci';
|
||||
create table t1 select repeat('a',4000) a;
|
||||
delete from t1;
|
||||
insert into t1 values ('a'), ('a '), ('a\t');
|
||||
select collation(a),hex(a) from t1 order by a;
|
||||
collation(a) hex(a)
|
||||
sjis_japanese_ci 6109
|
||||
sjis_japanese_ci 61
|
||||
sjis_japanese_ci 6120
|
||||
drop table t1;
|
||||
create table t1 engine=innodb select repeat('a',50) as c1;
|
||||
alter table t1 add index(c1(5));
|
||||
insert into t1 values ('abcdefg'),('abcde100'),('abcde110'),('abcde111');
|
||||
select collation(c1) from t1 limit 1;
|
||||
collation(c1)
|
||||
sjis_japanese_ci
|
||||
select c1 from t1 where c1 like 'abcdef%' order by c1;
|
||||
c1
|
||||
abcdefg
|
||||
select c1 from t1 where c1 like 'abcde1%' order by c1;
|
||||
c1
|
||||
abcde100
|
||||
abcde110
|
||||
abcde111
|
||||
select c1 from t1 where c1 like 'abcde11%' order by c1;
|
||||
c1
|
||||
abcde110
|
||||
abcde111
|
||||
select c1 from t1 where c1 like 'abcde111%' order by c1;
|
||||
c1
|
||||
abcde111
|
||||
drop table t1;
|
||||
select @@collation_connection;
|
||||
@@collation_connection
|
||||
sjis_japanese_ci
|
||||
create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
|
||||
insert into t1 values('abcdef');
|
||||
insert into t1 values('_bcdef');
|
||||
insert into t1 values('a_cdef');
|
||||
insert into t1 values('ab_def');
|
||||
insert into t1 values('abc_ef');
|
||||
insert into t1 values('abcd_f');
|
||||
insert into t1 values('abcde_');
|
||||
select c1 as c1u from t1 where c1 like 'ab\_def';
|
||||
c1u
|
||||
ab_def
|
||||
select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
|
||||
c2h
|
||||
ab_def
|
||||
drop table t1;
|
||||
CREATE TABLE t1 AS
|
||||
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
|
||||
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
|
||||
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
|
||||
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
|
||||
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
|
||||
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
|
||||
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
|
||||
hex(concat(repeat(0xF1F2, 10), '%'))
|
||||
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
|
||||
3 rows expected
|
||||
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
|
||||
a hex(b) c
|
||||
2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
||||
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
||||
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
||||
DROP TABLE t1;
|
||||
SET collation_connection='sjis_bin';
|
||||
create table t1 select repeat('a',4000) a;
|
||||
delete from t1;
|
||||
insert into t1 values ('a'), ('a '), ('a\t');
|
||||
select collation(a),hex(a) from t1 order by a;
|
||||
collation(a) hex(a)
|
||||
sjis_bin 6109
|
||||
sjis_bin 61
|
||||
sjis_bin 6120
|
||||
drop table t1;
|
||||
create table t1 engine=innodb select repeat('a',50) as c1;
|
||||
alter table t1 add index(c1(5));
|
||||
insert into t1 values ('abcdefg'),('abcde100'),('abcde110'),('abcde111');
|
||||
select collation(c1) from t1 limit 1;
|
||||
collation(c1)
|
||||
sjis_bin
|
||||
select c1 from t1 where c1 like 'abcdef%' order by c1;
|
||||
c1
|
||||
abcdefg
|
||||
select c1 from t1 where c1 like 'abcde1%' order by c1;
|
||||
c1
|
||||
abcde100
|
||||
abcde110
|
||||
abcde111
|
||||
select c1 from t1 where c1 like 'abcde11%' order by c1;
|
||||
c1
|
||||
abcde110
|
||||
abcde111
|
||||
select c1 from t1 where c1 like 'abcde111%' order by c1;
|
||||
c1
|
||||
abcde111
|
||||
drop table t1;
|
||||
select @@collation_connection;
|
||||
@@collation_connection
|
||||
sjis_bin
|
||||
create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
|
||||
insert into t1 values('abcdef');
|
||||
insert into t1 values('_bcdef');
|
||||
insert into t1 values('a_cdef');
|
||||
insert into t1 values('ab_def');
|
||||
insert into t1 values('abc_ef');
|
||||
insert into t1 values('abcd_f');
|
||||
insert into t1 values('abcde_');
|
||||
select c1 as c1u from t1 where c1 like 'ab\_def';
|
||||
c1u
|
||||
ab_def
|
||||
select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
|
||||
c2h
|
||||
ab_def
|
||||
drop table t1;
|
||||
CREATE TABLE t1 AS
|
||||
SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d;
|
||||
ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b);
|
||||
INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5));
|
||||
INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10));
|
||||
INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11));
|
||||
INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12));
|
||||
SELECT hex(concat(repeat(0xF1F2, 10), '%'));
|
||||
hex(concat(repeat(0xF1F2, 10), '%'))
|
||||
F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225
|
||||
3 rows expected
|
||||
SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%');
|
||||
a hex(b) c
|
||||
2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
||||
3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
||||
4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2
|
||||
DROP TABLE t1;
|
||||
SET NAMES sjis;
|
||||
SELECT HEX('佐淘 圭') FROM DUAL;
|
||||
HEX('佐淘 圭')
|
||||
8DB2939181408C5C
|
||||
# Start of 5.1 tests
|
||||
Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
|
||||
CREATE TABLE t1 (a varchar(16)) character set sjis;
|
||||
INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
|
||||
SELECT hex(a), hex(lower(a)), hex(upper(a)) FROM t1 ORDER BY binary(a);
|
||||
hex(a) hex(lower(a)) hex(upper(a))
|
||||
8352835E 8352835E 8352835E
|
||||
8372835E 8372835E 8372835E
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug#11766519 - Bug#59648: MY_STRTOLL10_MB2: ASSERTION `(*ENDPTR - S) % 2 == 0' FAILED.
|
||||
#
|
||||
SELECT QUOTE('ソ');
|
||||
QUOTE('ソ')
|
||||
'ソ'
|
||||
# End of 5.1 tests
|
||||
2995
build/lib/mysql/mysql-test/r/ctype_tis620.result
Normal file
2995
build/lib/mysql/mysql-test/r/ctype_tis620.result
Normal file
File diff suppressed because one or more lines are too long
2890
build/lib/mysql/mysql-test/r/ctype_uca.result
Normal file
2890
build/lib/mysql/mysql-test/r/ctype_uca.result
Normal file
File diff suppressed because it is too large
Load Diff
1278
build/lib/mysql/mysql-test/r/ctype_ucs.result
Normal file
1278
build/lib/mysql/mysql-test/r/ctype_ucs.result
Normal file
File diff suppressed because it is too large
Load Diff
34
build/lib/mysql/mysql-test/r/ctype_ucs2_def.result
Normal file
34
build/lib/mysql/mysql-test/r/ctype_ucs2_def.result
Normal file
@@ -0,0 +1,34 @@
|
||||
show variables like 'collation_server';
|
||||
Variable_name Value
|
||||
collation_server ucs2_unicode_ci
|
||||
show variables like "%character_set_ser%";
|
||||
Variable_name Value
|
||||
character_set_server ucs2
|
||||
DROP TABLE IF EXISTS t1;
|
||||
create table t1 (a int);
|
||||
drop table t1;
|
||||
End of 4.1 tests
|
||||
create table t1 (a char(1) character set latin1);
|
||||
insert into t1 values ('a'),('b'),('c');
|
||||
select hex(group_concat(a)) from t1;
|
||||
hex(group_concat(a))
|
||||
612C622C63
|
||||
drop table t1;
|
||||
CREATE TABLE t1(col1 VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL,
|
||||
col2 VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL,
|
||||
UNIQUE KEY key1 USING HASH (col1, col2)) ENGINE=MEMORY;
|
||||
INSERT INTO t1 VALUES('A', 'A'), ('B', 'B'), ('C', 'C');
|
||||
INSERT INTO t1 VALUES('A ', 'A ');
|
||||
ERROR 23000: Duplicate entry '' for key 'key1'
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 CHAR(255) CHARACTER SET UCS2 COLLATE UCS2_BIN NOT NULL,
|
||||
KEY(c1)
|
||||
) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES ('marshall\'s');
|
||||
INSERT INTO t1 VALUES ('marsh');
|
||||
CHECK TABLE t1 EXTENDED;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
2389
build/lib/mysql/mysql-test/r/ctype_ujis.result
Normal file
2389
build/lib/mysql/mysql-test/r/ctype_ujis.result
Normal file
File diff suppressed because it is too large
Load Diff
19159
build/lib/mysql/mysql-test/r/ctype_ujis_ucs2.result
Normal file
19159
build/lib/mysql/mysql-test/r/ctype_ujis_ucs2.result
Normal file
File diff suppressed because it is too large
Load Diff
1955
build/lib/mysql/mysql-test/r/ctype_utf8.result
Normal file
1955
build/lib/mysql/mysql-test/r/ctype_utf8.result
Normal file
File diff suppressed because it is too large
Load Diff
625
build/lib/mysql/mysql-test/r/date_formats.result
Normal file
625
build/lib/mysql/mysql-test/r/date_formats.result
Normal file
@@ -0,0 +1,625 @@
|
||||
drop table if exists t1;
|
||||
SELECT variable_name, variable_value
|
||||
FROM information_schema.global_variables
|
||||
WHERE variable_name IN ('date_format', 'datetime_format', 'time_format')
|
||||
ORDER BY variable_name;
|
||||
variable_name variable_value
|
||||
DATETIME_FORMAT %Y-%m-%d %H:%i:%s
|
||||
DATE_FORMAT %d.%m.%Y
|
||||
TIME_FORMAT %H.%i.%s
|
||||
SELECT variable_name, variable_value
|
||||
FROM information_schema.session_variables
|
||||
WHERE variable_name IN ('date_format', 'datetime_format', 'time_format')
|
||||
ORDER BY variable_name;
|
||||
variable_name variable_value
|
||||
DATETIME_FORMAT %Y-%m-%d %H:%i:%s
|
||||
DATE_FORMAT %d.%m.%Y
|
||||
TIME_FORMAT %H.%i.%s
|
||||
SET time_format='%H%i%s';
|
||||
SET time_format='%H:%i:%s.%f';
|
||||
SET time_format='%h-%i-%s.%f%p';
|
||||
SET time_format='%h:%i:%s.%f %p';
|
||||
SET time_format='%h:%i:%s%p';
|
||||
SET date_format='%Y%m%d';
|
||||
SET date_format='%Y.%m.%d';
|
||||
SET date_format='%d.%m.%Y';
|
||||
SET date_format='%m-%d-%Y';
|
||||
set datetime_format= '%Y%m%d%H%i%s';
|
||||
set datetime_format= '%Y-%m-%d %H:%i:%s';
|
||||
set datetime_format= '%m-%d-%y %H:%i:%s.%f';
|
||||
set datetime_format= '%d-%m-%Y %h:%i:%s%p';
|
||||
set datetime_format= '%H:%i:%s %Y-%m-%d';
|
||||
set datetime_format= '%H:%i:%s.%f %m-%d-%Y';
|
||||
set datetime_format= '%h:%i:%s %p %Y-%m-%d';
|
||||
set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d';
|
||||
SELECT variable_name, variable_value
|
||||
FROM information_schema.session_variables
|
||||
WHERE variable_name IN ('date_format', 'datetime_format', 'time_format')
|
||||
ORDER BY variable_name;
|
||||
variable_name variable_value
|
||||
DATETIME_FORMAT %h:%i:%s.%f %p %Y-%m-%d
|
||||
DATE_FORMAT %m-%d-%Y
|
||||
TIME_FORMAT %h:%i:%s%p
|
||||
SET time_format='%h:%i:%s';
|
||||
ERROR 42000: Variable 'time_format' can't be set to the value of '%h:%i:%s'
|
||||
SET time_format='%H %i:%s';
|
||||
ERROR 42000: Variable 'time_format' can't be set to the value of '%H %i:%s'
|
||||
SET time_format='%H::%i:%s';
|
||||
ERROR 42000: Variable 'time_format' can't be set to the value of '%H::%i:%s'
|
||||
SET time_format='%H:%i:%s%f';
|
||||
ERROR 42000: Variable 'time_format' can't be set to the value of '%H:%i:%s%f'
|
||||
SET time_format='%H:%i.%f:%s';
|
||||
ERROR 42000: Variable 'time_format' can't be set to the value of '%H:%i.%f:%s'
|
||||
SET time_format='%H:%i:%s%p';
|
||||
ERROR 42000: Variable 'time_format' can't be set to the value of '%H:%i:%s%p'
|
||||
SET time_format='%h:%i:%s.%f %p %Y-%m-%d';
|
||||
ERROR 42000: Variable 'time_format' can't be set to the value of '%h:%i:%s.%f %p %Y-%m-%d'
|
||||
SET time_format='%H%i%s.%f';
|
||||
ERROR 42000: Variable 'time_format' can't be set to the value of '%H%i%s.%f'
|
||||
SET time_format='%H:%i-%s.%f';
|
||||
ERROR 42000: Variable 'time_format' can't be set to the value of '%H:%i-%s.%f'
|
||||
SET date_format='%d.%m.%d';
|
||||
ERROR 42000: Variable 'date_format' can't be set to the value of '%d.%m.%d'
|
||||
SET datetime_format='%h.%m.%y %d.%i.%s';
|
||||
ERROR 42000: Variable 'datetime_format' can't be set to the value of '%h.%m.%y %d.%i.%s'
|
||||
set datetime_format= '%H:%i:%s.%f %p %Y-%m-%d';
|
||||
ERROR 42000: Variable 'datetime_format' can't be set to the value of '%H:%i:%s.%f %p %Y-%m-%d'
|
||||
set GLOBAL datetime_format= '%H:%i:%s %Y-%m-%d';
|
||||
SET SESSION datetime_format=default;
|
||||
select @@global.datetime_format, @@session.datetime_format;
|
||||
@@global.datetime_format @@session.datetime_format
|
||||
%H:%i:%s %Y-%m-%d %H:%i:%s %Y-%m-%d
|
||||
SET GLOBAL datetime_format=default;
|
||||
SET SESSION datetime_format=default;
|
||||
select @@global.datetime_format, @@session.datetime_format;
|
||||
@@global.datetime_format @@session.datetime_format
|
||||
%Y-%m-%d %H:%i:%s %Y-%m-%d %H:%i:%s
|
||||
SET GLOBAL date_format=default;
|
||||
SET GLOBAL time_format=default;
|
||||
SET GLOBAL datetime_format=default;
|
||||
SET time_format=default;
|
||||
SET date_format=default;
|
||||
SET datetime_format=default;
|
||||
select str_to_date(concat('15-01-2001',' 2:59:58.999'),
|
||||
concat('%d-%m-%Y',' ','%H:%i:%s.%f'));
|
||||
str_to_date(concat('15-01-2001',' 2:59:58.999'),
|
||||
concat('%d-%m-%Y',' ','%H:%i:%s.%f'))
|
||||
2001-01-15 02:59:58.999000
|
||||
select STR_TO_DATE('2004.12.12 22.30.61','%Y.%m.%d %T');
|
||||
STR_TO_DATE('2004.12.12 22.30.61','%Y.%m.%d %T')
|
||||
NULL
|
||||
Warnings:
|
||||
Error 1411 Incorrect time value: '22.30.61' for function str_to_date
|
||||
create table t1 (date char(30), format char(30) not null);
|
||||
insert into t1 values
|
||||
('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'),
|
||||
('03-01-02 8:11:2.123456', '%y-%m-%d %H:%i:%S.%#'),
|
||||
('0003-01-02 8:11:2.123456', '%Y-%m-%d %H:%i:%S.%#'),
|
||||
('03-01-02 8:11:2.123456', '%Y-%m-%d %H:%i:%S.%#'),
|
||||
('2003-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p'),
|
||||
('2003-01-02 01:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f%p'),
|
||||
('2003-01-02 02:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f %p'),
|
||||
('2003-01-02 12:11:12.12345 am', '%Y-%m-%d %h:%i:%S.%f%p'),
|
||||
('2003-01-02 11:11:12Pm', '%Y-%m-%d %h:%i:%S%p'),
|
||||
('10:20:10', '%H:%i:%s'),
|
||||
('10:20:10', '%h:%i:%s.%f'),
|
||||
('10:20:10', '%T'),
|
||||
('10:20:10AM', '%h:%i:%s%p'),
|
||||
('10:20:10AM', '%r'),
|
||||
('10:20:10.44AM', '%h:%i:%s.%f%p'),
|
||||
('15-01-2001 12:59:58', '%d-%m-%Y %H:%i:%S'),
|
||||
('15 September 2001', '%d %M %Y'),
|
||||
('15 SEPTEMB 2001', '%d %M %Y'),
|
||||
('15 MAY 2001', '%d %b %Y'),
|
||||
('15th May 2001', '%D %b %Y'),
|
||||
('Sunday 15 MAY 2001', '%W %d %b %Y'),
|
||||
('Sund 15 MAY 2001', '%W %d %b %Y'),
|
||||
('Tuesday 00 2002', '%W %U %Y'),
|
||||
('Thursday 53 1998', '%W %u %Y'),
|
||||
('Sunday 01 2001', '%W %v %x'),
|
||||
('Tuesday 52 2001', '%W %V %X'),
|
||||
('060 2004', '%j %Y'),
|
||||
('4 53 1998', '%w %u %Y'),
|
||||
('15-01-2001', '%d-%m-%Y %H:%i:%S'),
|
||||
('15-01-20', '%d-%m-%y'),
|
||||
('15-2001-1', '%d-%Y-%c');
|
||||
select date,format,str_to_date(date, format) as str_to_date from t1;
|
||||
date format str_to_date
|
||||
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12
|
||||
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
|
||||
0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 0003-01-02 08:11:02
|
||||
03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
|
||||
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
|
||||
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.123450
|
||||
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450
|
||||
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 00:11:12.123450
|
||||
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 23:11:12
|
||||
10:20:10 %H:%i:%s 0000-00-00 10:20:10
|
||||
10:20:10 %h:%i:%s.%f 0000-00-00 10:20:10
|
||||
10:20:10 %T 0000-00-00 10:20:10
|
||||
10:20:10AM %h:%i:%s%p 0000-00-00 10:20:10
|
||||
10:20:10AM %r 0000-00-00 10:20:10
|
||||
10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10.440000
|
||||
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 12:59:58
|
||||
15 September 2001 %d %M %Y 2001-09-15 00:00:00
|
||||
15 SEPTEMB 2001 %d %M %Y 2001-09-15 00:00:00
|
||||
15 MAY 2001 %d %b %Y 2001-05-15 00:00:00
|
||||
15th May 2001 %D %b %Y 2001-05-15 00:00:00
|
||||
Sunday 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
|
||||
Sund 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
|
||||
Tuesday 00 2002 %W %U %Y 2002-01-01 00:00:00
|
||||
Thursday 53 1998 %W %u %Y 1998-12-31 00:00:00
|
||||
Sunday 01 2001 %W %v %x 2001-01-07 00:00:00
|
||||
Tuesday 52 2001 %W %V %X 2002-01-01 00:00:00
|
||||
060 2004 %j %Y 2004-02-29 00:00:00
|
||||
4 53 1998 %w %u %Y 1998-12-31 00:00:00
|
||||
15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15 00:00:00
|
||||
15-01-20 %d-%m-%y 2020-01-15 00:00:00
|
||||
15-2001-1 %d-%Y-%c 2001-01-15 00:00:00
|
||||
select date,format,concat('',str_to_date(date, format)) as con from t1;
|
||||
date format con
|
||||
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12
|
||||
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
|
||||
0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 0003-01-02 08:11:02
|
||||
03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
|
||||
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
|
||||
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.123450
|
||||
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450
|
||||
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 00:11:12.123450
|
||||
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 23:11:12
|
||||
10:20:10 %H:%i:%s 0000-00-00 10:20:10
|
||||
10:20:10 %h:%i:%s.%f 0000-00-00 10:20:10
|
||||
10:20:10 %T 0000-00-00 10:20:10
|
||||
10:20:10AM %h:%i:%s%p 0000-00-00 10:20:10
|
||||
10:20:10AM %r 0000-00-00 10:20:10
|
||||
10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10.440000
|
||||
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 12:59:58
|
||||
15 September 2001 %d %M %Y 2001-09-15 00:00:00
|
||||
15 SEPTEMB 2001 %d %M %Y 2001-09-15 00:00:00
|
||||
15 MAY 2001 %d %b %Y 2001-05-15 00:00:00
|
||||
15th May 2001 %D %b %Y 2001-05-15 00:00:00
|
||||
Sunday 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
|
||||
Sund 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
|
||||
Tuesday 00 2002 %W %U %Y 2002-01-01 00:00:00
|
||||
Thursday 53 1998 %W %u %Y 1998-12-31 00:00:00
|
||||
Sunday 01 2001 %W %v %x 2001-01-07 00:00:00
|
||||
Tuesday 52 2001 %W %V %X 2002-01-01 00:00:00
|
||||
060 2004 %j %Y 2004-02-29 00:00:00
|
||||
4 53 1998 %w %u %Y 1998-12-31 00:00:00
|
||||
15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15 00:00:00
|
||||
15-01-20 %d-%m-%y 2020-01-15 00:00:00
|
||||
15-2001-1 %d-%Y-%c 2001-01-15 00:00:00
|
||||
select date,format,cast(str_to_date(date, format) as datetime) as datetime from t1;
|
||||
date format datetime
|
||||
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12
|
||||
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
|
||||
0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 0003-01-02 08:11:02
|
||||
03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
|
||||
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
|
||||
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.123450
|
||||
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450
|
||||
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 00:11:12.123450
|
||||
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 23:11:12
|
||||
10:20:10 %H:%i:%s 0000-00-00 10:20:10
|
||||
10:20:10 %h:%i:%s.%f 0000-00-00 10:20:10
|
||||
10:20:10 %T 0000-00-00 10:20:10
|
||||
10:20:10AM %h:%i:%s%p 0000-00-00 10:20:10
|
||||
10:20:10AM %r 0000-00-00 10:20:10
|
||||
10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10.440000
|
||||
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 12:59:58
|
||||
15 September 2001 %d %M %Y 2001-09-15 00:00:00
|
||||
15 SEPTEMB 2001 %d %M %Y 2001-09-15 00:00:00
|
||||
15 MAY 2001 %d %b %Y 2001-05-15 00:00:00
|
||||
15th May 2001 %D %b %Y 2001-05-15 00:00:00
|
||||
Sunday 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
|
||||
Sund 15 MAY 2001 %W %d %b %Y 2001-05-15 00:00:00
|
||||
Tuesday 00 2002 %W %U %Y 2002-01-01 00:00:00
|
||||
Thursday 53 1998 %W %u %Y 1998-12-31 00:00:00
|
||||
Sunday 01 2001 %W %v %x 2001-01-07 00:00:00
|
||||
Tuesday 52 2001 %W %V %X 2002-01-01 00:00:00
|
||||
060 2004 %j %Y 2004-02-29 00:00:00
|
||||
4 53 1998 %w %u %Y 1998-12-31 00:00:00
|
||||
15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15 00:00:00
|
||||
15-01-20 %d-%m-%y 2020-01-15 00:00:00
|
||||
15-2001-1 %d-%Y-%c 2001-01-15 00:00:00
|
||||
select date,format,DATE(str_to_date(date, format)) as date2 from t1;
|
||||
date format date2
|
||||
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02
|
||||
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02
|
||||
0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 0003-01-02
|
||||
03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 2003-01-02
|
||||
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02
|
||||
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02
|
||||
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02
|
||||
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02
|
||||
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02
|
||||
10:20:10 %H:%i:%s 0000-00-00
|
||||
10:20:10 %h:%i:%s.%f 0000-00-00
|
||||
10:20:10 %T 0000-00-00
|
||||
10:20:10AM %h:%i:%s%p 0000-00-00
|
||||
10:20:10AM %r 0000-00-00
|
||||
10:20:10.44AM %h:%i:%s.%f%p 0000-00-00
|
||||
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15
|
||||
15 September 2001 %d %M %Y 2001-09-15
|
||||
15 SEPTEMB 2001 %d %M %Y 2001-09-15
|
||||
15 MAY 2001 %d %b %Y 2001-05-15
|
||||
15th May 2001 %D %b %Y 2001-05-15
|
||||
Sunday 15 MAY 2001 %W %d %b %Y 2001-05-15
|
||||
Sund 15 MAY 2001 %W %d %b %Y 2001-05-15
|
||||
Tuesday 00 2002 %W %U %Y 2002-01-01
|
||||
Thursday 53 1998 %W %u %Y 1998-12-31
|
||||
Sunday 01 2001 %W %v %x 2001-01-07
|
||||
Tuesday 52 2001 %W %V %X 2002-01-01
|
||||
060 2004 %j %Y 2004-02-29
|
||||
4 53 1998 %w %u %Y 1998-12-31
|
||||
15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15
|
||||
15-01-20 %d-%m-%y 2020-01-15
|
||||
15-2001-1 %d-%Y-%c 2001-01-15
|
||||
select date,format,TIME(str_to_date(date, format)) as time from t1;
|
||||
date format time
|
||||
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12
|
||||
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 08:11:02
|
||||
0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02
|
||||
03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02
|
||||
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 22:11:12
|
||||
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 01:11:12.123450
|
||||
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450
|
||||
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 00:11:12.123450
|
||||
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12
|
||||
10:20:10 %H:%i:%s 10:20:10
|
||||
10:20:10 %h:%i:%s.%f 10:20:10
|
||||
10:20:10 %T 10:20:10
|
||||
10:20:10AM %h:%i:%s%p 10:20:10
|
||||
10:20:10AM %r 10:20:10
|
||||
10:20:10.44AM %h:%i:%s.%f%p 10:20:10.440000
|
||||
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58
|
||||
15 September 2001 %d %M %Y 00:00:00
|
||||
15 SEPTEMB 2001 %d %M %Y 00:00:00
|
||||
15 MAY 2001 %d %b %Y 00:00:00
|
||||
15th May 2001 %D %b %Y 00:00:00
|
||||
Sunday 15 MAY 2001 %W %d %b %Y 00:00:00
|
||||
Sund 15 MAY 2001 %W %d %b %Y 00:00:00
|
||||
Tuesday 00 2002 %W %U %Y 00:00:00
|
||||
Thursday 53 1998 %W %u %Y 00:00:00
|
||||
Sunday 01 2001 %W %v %x 00:00:00
|
||||
Tuesday 52 2001 %W %V %X 00:00:00
|
||||
060 2004 %j %Y 00:00:00
|
||||
4 53 1998 %w %u %Y 00:00:00
|
||||
15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00
|
||||
15-01-20 %d-%m-%y 00:00:00
|
||||
15-2001-1 %d-%Y-%c 00:00:00
|
||||
select date,format,concat(TIME(str_to_date(date, format))) as time2 from t1;
|
||||
date format time2
|
||||
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12
|
||||
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 08:11:02
|
||||
0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02
|
||||
03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02
|
||||
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 22:11:12
|
||||
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 01:11:12.123450
|
||||
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450
|
||||
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 00:11:12.123450
|
||||
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12
|
||||
10:20:10 %H:%i:%s 10:20:10
|
||||
10:20:10 %h:%i:%s.%f 10:20:10
|
||||
10:20:10 %T 10:20:10
|
||||
10:20:10AM %h:%i:%s%p 10:20:10
|
||||
10:20:10AM %r 10:20:10
|
||||
10:20:10.44AM %h:%i:%s.%f%p 10:20:10.440000
|
||||
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58
|
||||
15 September 2001 %d %M %Y 00:00:00
|
||||
15 SEPTEMB 2001 %d %M %Y 00:00:00
|
||||
15 MAY 2001 %d %b %Y 00:00:00
|
||||
15th May 2001 %D %b %Y 00:00:00
|
||||
Sunday 15 MAY 2001 %W %d %b %Y 00:00:00
|
||||
Sund 15 MAY 2001 %W %d %b %Y 00:00:00
|
||||
Tuesday 00 2002 %W %U %Y 00:00:00
|
||||
Thursday 53 1998 %W %u %Y 00:00:00
|
||||
Sunday 01 2001 %W %v %x 00:00:00
|
||||
Tuesday 52 2001 %W %V %X 00:00:00
|
||||
060 2004 %j %Y 00:00:00
|
||||
4 53 1998 %w %u %Y 00:00:00
|
||||
15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00
|
||||
15-01-20 %d-%m-%y 00:00:00
|
||||
15-2001-1 %d-%Y-%c 00:00:00
|
||||
select concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d'));
|
||||
concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d'))
|
||||
2003-01-02 08:11:02.123456
|
||||
truncate table t1;
|
||||
insert into t1 values
|
||||
('2003-01-02 10:11:12 PM', '%Y-%m-%d %H:%i:%S %p'),
|
||||
('2003-01-02 10:11:12.123456', '%Y-%m-%d %h:%i:%S %p'),
|
||||
('2003-01-02 10:11:12AM', '%Y-%m-%d %h:%i:%S.%f %p'),
|
||||
('2003-01-02 10:11:12AN', '%Y-%m-%d %h:%i:%S%p'),
|
||||
('2003-01-02 10:11:12 PM', '%y-%m-%d %H:%i:%S %p'),
|
||||
('10:20:10AM', '%H:%i:%s%p'),
|
||||
('15 Septembei 2001', '%d %M %Y'),
|
||||
('15 Ju 2001', '%d %M %Y'),
|
||||
('Sund 15 MA', '%W %d %b %Y'),
|
||||
('Thursdai 12 1998', '%W %u %Y'),
|
||||
('Sunday 01 2001', '%W %v %X'),
|
||||
('Tuesday 52 2001', '%W %V %x'),
|
||||
('Tuesday 52 2001', '%W %V %Y'),
|
||||
('Tuesday 52 2001', '%W %u %x'),
|
||||
('7 53 1998', '%w %u %Y'),
|
||||
(NULL, get_format(DATE,'USA'));
|
||||
select date,format,str_to_date(date, format) as str_to_date from t1;
|
||||
date format str_to_date
|
||||
2003-01-02 10:11:12 PM %Y-%m-%d %H:%i:%S %p NULL
|
||||
2003-01-02 10:11:12.123456 %Y-%m-%d %h:%i:%S %p NULL
|
||||
2003-01-02 10:11:12AM %Y-%m-%d %h:%i:%S.%f %p NULL
|
||||
2003-01-02 10:11:12AN %Y-%m-%d %h:%i:%S%p NULL
|
||||
2003-01-02 10:11:12 PM %y-%m-%d %H:%i:%S %p NULL
|
||||
10:20:10AM %H:%i:%s%p NULL
|
||||
15 Septembei 2001 %d %M %Y NULL
|
||||
15 Ju 2001 %d %M %Y NULL
|
||||
Sund 15 MA %W %d %b %Y NULL
|
||||
Thursdai 12 1998 %W %u %Y NULL
|
||||
Sunday 01 2001 %W %v %X NULL
|
||||
Tuesday 52 2001 %W %V %x NULL
|
||||
Tuesday 52 2001 %W %V %Y NULL
|
||||
Tuesday 52 2001 %W %u %x NULL
|
||||
7 53 1998 %w %u %Y NULL
|
||||
NULL %m.%d.%Y NULL
|
||||
Warnings:
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12.123456' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AM' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AN' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '10:20:10AM' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '15 Septembei 2001' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '15 Ju 2001' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: 'Sund 15 MA' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: 'Thursdai 12 1998' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: 'Sunday 01 2001' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '7 53 1998' for function str_to_date
|
||||
select date,format,concat(str_to_date(date, format),'') as con from t1;
|
||||
date format con
|
||||
2003-01-02 10:11:12 PM %Y-%m-%d %H:%i:%S %p NULL
|
||||
2003-01-02 10:11:12.123456 %Y-%m-%d %h:%i:%S %p NULL
|
||||
2003-01-02 10:11:12AM %Y-%m-%d %h:%i:%S.%f %p NULL
|
||||
2003-01-02 10:11:12AN %Y-%m-%d %h:%i:%S%p NULL
|
||||
2003-01-02 10:11:12 PM %y-%m-%d %H:%i:%S %p NULL
|
||||
10:20:10AM %H:%i:%s%p NULL
|
||||
15 Septembei 2001 %d %M %Y NULL
|
||||
15 Ju 2001 %d %M %Y NULL
|
||||
Sund 15 MA %W %d %b %Y NULL
|
||||
Thursdai 12 1998 %W %u %Y NULL
|
||||
Sunday 01 2001 %W %v %X NULL
|
||||
Tuesday 52 2001 %W %V %x NULL
|
||||
Tuesday 52 2001 %W %V %Y NULL
|
||||
Tuesday 52 2001 %W %u %x NULL
|
||||
7 53 1998 %w %u %Y NULL
|
||||
NULL %m.%d.%Y NULL
|
||||
Warnings:
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12.123456' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AM' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12AN' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '10:20:10AM' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '15 Septembei 2001' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '15 Ju 2001' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: 'Sund 15 MA' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: 'Thursdai 12 1998' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: 'Sunday 01 2001' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
|
||||
Error 1411 Incorrect datetime value: '7 53 1998' for function str_to_date
|
||||
truncate table t1;
|
||||
insert into t1 values
|
||||
('10:20:10AM', '%h:%i:%s'),
|
||||
('2003-01-02 10:11:12', '%Y-%m-%d %h:%i:%S'),
|
||||
('03-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p');
|
||||
select date,format,str_to_date(date, format) as str_to_date from t1;
|
||||
date format str_to_date
|
||||
10:20:10AM %h:%i:%s 0000-00-00 10:20:10
|
||||
2003-01-02 10:11:12 %Y-%m-%d %h:%i:%S 2003-01-02 10:11:12
|
||||
03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
|
||||
Warnings:
|
||||
Warning 1292 Incorrect datetime value: '10:20:10AM'
|
||||
select date,format,concat(str_to_date(date, format),'') as con from t1;
|
||||
date format con
|
||||
10:20:10AM %h:%i:%s 0000-00-00 10:20:10
|
||||
2003-01-02 10:11:12 %Y-%m-%d %h:%i:%S 2003-01-02 10:11:12
|
||||
03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
|
||||
Warnings:
|
||||
Warning 1292 Incorrect datetime value: '10:20:10AM'
|
||||
drop table t1;
|
||||
select get_format(DATE, 'USA') as a;
|
||||
a
|
||||
%m.%d.%Y
|
||||
select get_format(TIME, 'internal') as a;
|
||||
a
|
||||
%H%i%s
|
||||
select get_format(DATETIME, 'eur') as a;
|
||||
a
|
||||
%Y-%m-%d %H.%i.%s
|
||||
select get_format(TIMESTAMP, 'eur') as a;
|
||||
a
|
||||
%Y-%m-%d %H.%i.%s
|
||||
select get_format(DATE, 'TEST') as a;
|
||||
a
|
||||
NULL
|
||||
select str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA'));
|
||||
str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA'))
|
||||
NULL
|
||||
Warnings:
|
||||
Error 1411 Incorrect datetime value: '15-01-2001 12:59:59' for function str_to_date
|
||||
explain extended select makedate(1997,1), addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM"),cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME), maketime(23,11,12),microsecond("1997-12-31 23:59:59.000001");
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select makedate(1997,1) AS `makedate(1997,1)`,addtime('31.12.97 11.59.59.999999 PM','1 1.1.1.000002') AS `addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,subtime('31.12.97 11.59.59.999999 PM','1 1.1.1.000002') AS `subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,timediff('01.01.97 11:59:59.000001 PM','31.12.95 11:59:59.000002 PM') AS `timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM")`,cast(str_to_date('15-01-2001 12:59:59','%d-%m-%Y %H:%i:%S') as time) AS `cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME)`,maketime(23,11,12) AS `maketime(23,11,12)`,microsecond('1997-12-31 23:59:59.000001') AS `microsecond("1997-12-31 23:59:59.000001")`
|
||||
create table t1 (d date);
|
||||
insert into t1 values ('2004-07-14'),('2005-07-14');
|
||||
select date_format(d,"%d") from t1 order by 1;
|
||||
date_format(d,"%d")
|
||||
14
|
||||
14
|
||||
drop table t1;
|
||||
select str_to_date("2003-....01ABCD-02 10:11:12.0012", "%Y-%.%m%@-%d %H:%i:%S.%f") as a;
|
||||
a
|
||||
2003-01-02 10:11:12.001200
|
||||
create table t1 select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f") as f1,
|
||||
str_to_date("10:11:12.0012", "%H:%i:%S.%f") as f2,
|
||||
str_to_date("2003-01-02", "%Y-%m-%d") as f3,
|
||||
str_to_date("02", "%d") as f4, str_to_date("02 10", "%d %H") as f5;
|
||||
describe t1;
|
||||
Field Type Null Key Default Extra
|
||||
f1 datetime YES NULL
|
||||
f2 time YES NULL
|
||||
f3 date YES NULL
|
||||
f4 date YES NULL
|
||||
f5 time YES NULL
|
||||
select * from t1;
|
||||
f1 f2 f3 f4 f5
|
||||
2003-01-02 10:11:12 10:11:12 2003-01-02 0000-00-02 58:00:00
|
||||
drop table t1;
|
||||
create table t1 select "02 10" as a, "%d %H" as b;
|
||||
select str_to_date(a,b) from t1;
|
||||
str_to_date(a,b)
|
||||
0000-00-02 10:00:00
|
||||
create table t2 select str_to_date(a,b) from t1;
|
||||
describe t2;
|
||||
Field Type Null Key Default Extra
|
||||
str_to_date(a,b) datetime YES NULL
|
||||
select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f") as f1,
|
||||
str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S") as f2,
|
||||
str_to_date("2003-01-02", "%Y-%m-%d") as f3,
|
||||
str_to_date("02 10:11:12", "%d %H:%i:%S.%f") as f4,
|
||||
str_to_date("02 10:11:12", "%d %H:%i:%S") as f5,
|
||||
str_to_date("02 10", "%d %f") as f6;
|
||||
f1 f2 f3 f4 f5 f6
|
||||
2003-01-02 10:11:12.001200 2003-01-02 10:11:12 2003-01-02 58:11:12 58:11:12 48:00:00.100000
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect datetime value: '2003-01-02 10:11:12.0012'
|
||||
drop table t1, t2;
|
||||
select str_to_date("2003-01-02 10:11:12.0012ABCD", "%Y-%m-%d %H:%i:%S.%f") as f1,
|
||||
addtime("-01:01:01.01 GGG", "-23:59:59.1") as f2,
|
||||
microsecond("1997-12-31 23:59:59.01XXXX") as f3;
|
||||
f1 f2 f3
|
||||
2003-01-02 10:11:12.001200 -25:01:00.110000 10000
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect datetime value: '2003-01-02 10:11:12.0012ABCD'
|
||||
Warning 1292 Truncated incorrect time value: '-01:01:01.01 GGG'
|
||||
Warning 1292 Truncated incorrect time value: '1997-12-31 23:59:59.01XXXX'
|
||||
select str_to_date("2003-04-05 g", "%Y-%m-%d") as f1,
|
||||
str_to_date("2003-04-05 10:11:12.101010234567", "%Y-%m-%d %H:%i:%S.%f") as f2;
|
||||
f1 f2
|
||||
2003-04-05 2003-04-05 10:11:12.101010
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect date value: '2003-04-05 g'
|
||||
Warning 1292 Truncated incorrect datetime value: '2003-04-05 10:11:12.101010234567'
|
||||
set names latin1;
|
||||
select date_format('2004-01-01','%W (%a), %e %M (%b) %Y');
|
||||
date_format('2004-01-01','%W (%a), %e %M (%b) %Y')
|
||||
Thursday (Thu), 1 January (Jan) 2004
|
||||
set lc_time_names=ru_RU;
|
||||
set names koi8r;
|
||||
select date_format('2004-01-01','%W (%a), %e %M (%b) %Y');
|
||||
date_format('2004-01-01','%W (%a), %e %M (%b) %Y')
|
||||
þÅÔ×ÅÒÇ (þÔ×), 1 ñÎ×ÁÒÑ (ñÎ×) 2004
|
||||
set lc_time_names=de_DE;
|
||||
set names latin1;
|
||||
select date_format('2004-01-01','%W (%a), %e %M (%b) %Y');
|
||||
date_format('2004-01-01','%W (%a), %e %M (%b) %Y')
|
||||
Donnerstag (Do), 1 Januar (Jan) 2004
|
||||
set names latin1;
|
||||
set lc_time_names=en_US;
|
||||
create table t1 (f1 datetime);
|
||||
insert into t1 (f1) values ("2005-01-01");
|
||||
insert into t1 (f1) values ("2005-02-01");
|
||||
select date_format(f1, "%m") as d1, date_format(f1, "%M") as d2 from t1 order by date_format(f1, "%M");
|
||||
d1 d2
|
||||
02 February
|
||||
01 January
|
||||
drop table t1;
|
||||
select str_to_date( 1, NULL );
|
||||
str_to_date( 1, NULL )
|
||||
NULL
|
||||
select str_to_date( NULL, 1 );
|
||||
str_to_date( NULL, 1 )
|
||||
NULL
|
||||
select str_to_date( 1, IF(1=1,NULL,NULL) );
|
||||
str_to_date( 1, IF(1=1,NULL,NULL) )
|
||||
NULL
|
||||
SELECT TIME_FORMAT("24:00:00", '%r');
|
||||
TIME_FORMAT("24:00:00", '%r')
|
||||
12:00:00 AM
|
||||
SELECT TIME_FORMAT("00:00:00", '%r');
|
||||
TIME_FORMAT("00:00:00", '%r')
|
||||
12:00:00 AM
|
||||
SELECT TIME_FORMAT("12:00:00", '%r');
|
||||
TIME_FORMAT("12:00:00", '%r')
|
||||
12:00:00 PM
|
||||
SELECT TIME_FORMAT("15:00:00", '%r');
|
||||
TIME_FORMAT("15:00:00", '%r')
|
||||
03:00:00 PM
|
||||
SELECT TIME_FORMAT("01:00:00", '%r');
|
||||
TIME_FORMAT("01:00:00", '%r')
|
||||
01:00:00 AM
|
||||
SELECT TIME_FORMAT("25:00:00", '%r');
|
||||
TIME_FORMAT("25:00:00", '%r')
|
||||
01:00:00 AM
|
||||
SELECT TIME_FORMAT("00:00:00", '%l %p');
|
||||
TIME_FORMAT("00:00:00", '%l %p')
|
||||
12 AM
|
||||
SELECT TIME_FORMAT("01:00:00", '%l %p');
|
||||
TIME_FORMAT("01:00:00", '%l %p')
|
||||
1 AM
|
||||
SELECT TIME_FORMAT("12:00:00", '%l %p');
|
||||
TIME_FORMAT("12:00:00", '%l %p')
|
||||
12 PM
|
||||
SELECT TIME_FORMAT("23:00:00", '%l %p');
|
||||
TIME_FORMAT("23:00:00", '%l %p')
|
||||
11 PM
|
||||
SELECT TIME_FORMAT("24:00:00", '%l %p');
|
||||
TIME_FORMAT("24:00:00", '%l %p')
|
||||
12 AM
|
||||
SELECT TIME_FORMAT("25:00:00", '%l %p');
|
||||
TIME_FORMAT("25:00:00", '%l %p')
|
||||
1 AM
|
||||
SELECT DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896);
|
||||
DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896)
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 1292 Incorrect datetime value: '%Y-%m-%d %H:%i:%s'
|
||||
select str_to_date('04 /30/2004', '%m /%d/%Y');
|
||||
str_to_date('04 /30/2004', '%m /%d/%Y')
|
||||
2004-04-30
|
||||
select str_to_date('04/30 /2004', '%m /%d /%Y');
|
||||
str_to_date('04/30 /2004', '%m /%d /%Y')
|
||||
2004-04-30
|
||||
select str_to_date('04/30/2004 ', '%m/%d/%Y ');
|
||||
str_to_date('04/30/2004 ', '%m/%d/%Y ')
|
||||
2004-04-30
|
||||
"End of 4.1 tests"
|
||||
SELECT DATE_FORMAT("0000-01-01",'%W %d %M %Y') as valid_date;
|
||||
valid_date
|
||||
Sunday 01 January 0000
|
||||
SELECT DATE_FORMAT("0000-02-28",'%W %d %M %Y') as valid_date;
|
||||
valid_date
|
||||
Tuesday 28 February 0000
|
||||
SELECT DATE_FORMAT("2009-01-01",'%W %d %M %Y') as valid_date;
|
||||
valid_date
|
||||
Thursday 01 January 2009
|
||||
"End of 5.0 tests"
|
||||
#
|
||||
# Start of 5.1 tests
|
||||
#
|
||||
#
|
||||
# Bug#58005 utf8 + get_format causes failed assertion: !str || str != Ptr'
|
||||
#
|
||||
SET NAMES utf8;
|
||||
SELECT LEAST('%', GET_FORMAT(datetime, 'eur'), CAST(GET_FORMAT(datetime, 'eur') AS CHAR(65535)));
|
||||
LEAST('%', GET_FORMAT(datetime, 'eur'), CAST(GET_FORMAT(datetime, 'eur') AS CHAR(65535)))
|
||||
%
|
||||
SET NAMES latin1;
|
||||
#
|
||||
# End of 5.1 tests
|
||||
#
|
||||
2839
build/lib/mysql/mysql-test/r/ddl_i18n_koi8r.result
Normal file
2839
build/lib/mysql/mysql-test/r/ddl_i18n_koi8r.result
Normal file
File diff suppressed because it is too large
Load Diff
2839
build/lib/mysql/mysql-test/r/ddl_i18n_utf8.result
Normal file
2839
build/lib/mysql/mysql-test/r/ddl_i18n_utf8.result
Normal file
File diff suppressed because it is too large
Load Diff
125
build/lib/mysql/mysql-test/r/deadlock_innodb.result
Normal file
125
build/lib/mysql/mysql-test/r/deadlock_innodb.result
Normal file
@@ -0,0 +1,125 @@
|
||||
# Establish connection con1 (user=root)
|
||||
# Establish connection con2 (user=root)
|
||||
drop table if exists t1,t2;
|
||||
# Switch to connection con1
|
||||
create table t1 (id integer, x integer) engine = InnoDB;
|
||||
insert into t1 values(0, 0);
|
||||
set autocommit=0;
|
||||
SELECT * from t1 where id = 0 FOR UPDATE;
|
||||
id x
|
||||
0 0
|
||||
# Switch to connection con2
|
||||
set autocommit=0;
|
||||
update t1 set x=2 where id = 0;
|
||||
# Switch to connection con1
|
||||
update t1 set x=1 where id = 0;
|
||||
select * from t1;
|
||||
id x
|
||||
0 1
|
||||
commit;
|
||||
# Switch to connection con2
|
||||
commit;
|
||||
# Switch to connection con1
|
||||
select * from t1;
|
||||
id x
|
||||
0 2
|
||||
commit;
|
||||
drop table t1;
|
||||
# Switch to connection con1
|
||||
create table t1 (id integer, x integer) engine = InnoDB;
|
||||
create table t2 (b integer, a integer) engine = InnoDB;
|
||||
insert into t1 values(0, 0), (300, 300);
|
||||
insert into t2 values(0, 10), (1, 20), (2, 30);
|
||||
commit;
|
||||
set autocommit=0;
|
||||
select * from t2;
|
||||
b a
|
||||
0 10
|
||||
1 20
|
||||
2 30
|
||||
update t2 set a=100 where b=(SELECT x from t1 where id = b FOR UPDATE);
|
||||
select * from t2;
|
||||
b a
|
||||
0 100
|
||||
1 20
|
||||
2 30
|
||||
select * from t1;
|
||||
id x
|
||||
0 0
|
||||
300 300
|
||||
# Switch to connection con2
|
||||
set autocommit=0;
|
||||
update t1 set x=2 where id = 0;
|
||||
# Switch to connection con1
|
||||
update t1 set x=1 where id = 0;
|
||||
select * from t1;
|
||||
id x
|
||||
0 1
|
||||
300 300
|
||||
commit;
|
||||
# Switch to connection con2
|
||||
commit;
|
||||
# Switch to connection con1
|
||||
select * from t1;
|
||||
id x
|
||||
0 2
|
||||
300 300
|
||||
commit;
|
||||
drop table t1, t2;
|
||||
create table t1 (id integer, x integer) engine = InnoDB;
|
||||
create table t2 (b integer, a integer) engine = InnoDB;
|
||||
insert into t1 values(0, 0), (300, 300);
|
||||
insert into t2 values(0, 0), (1, 20), (2, 30);
|
||||
commit;
|
||||
# Switch to connection con1
|
||||
select a,b from t2 UNION SELECT id, x from t1 FOR UPDATE;
|
||||
a b
|
||||
0 0
|
||||
20 1
|
||||
30 2
|
||||
300 300
|
||||
select * from t2;
|
||||
b a
|
||||
0 0
|
||||
1 20
|
||||
2 30
|
||||
select * from t1;
|
||||
id x
|
||||
0 0
|
||||
300 300
|
||||
# Switch to connection con2
|
||||
update t2 set a=2 where b = 0;
|
||||
select * from t2;
|
||||
b a
|
||||
0 2
|
||||
1 20
|
||||
2 30
|
||||
update t1 set x=2 where id = 0;
|
||||
# Switch to connection con1
|
||||
update t1 set x=1 where id = 0;
|
||||
select * from t1;
|
||||
id x
|
||||
0 1
|
||||
300 300
|
||||
commit;
|
||||
# Switch to connection con2
|
||||
commit;
|
||||
# Switch to connection con1
|
||||
select * from t1;
|
||||
id x
|
||||
0 2
|
||||
300 300
|
||||
commit;
|
||||
# Switch to connection default + disconnect con1 and con2
|
||||
drop table t1, t2;
|
||||
End of 4.1 tests
|
||||
set storage_engine=innodb;
|
||||
drop table if exists a;
|
||||
drop table if exists A;
|
||||
create table A (c int);
|
||||
insert into A (c) values (0);
|
||||
create table a as select * from A;
|
||||
drop table A;
|
||||
drop table if exists a;
|
||||
set storage_engine=default;
|
||||
End of 5.0 tests.
|
||||
277
build/lib/mysql/mysql-test/r/debug_sync.result
Normal file
277
build/lib/mysql/mysql-test/r/debug_sync.result
Normal file
@@ -0,0 +1,277 @@
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
DROP TABLE IF EXISTS t1;
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
Variable_name Value
|
||||
debug_sync ON - current signal: ''
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 HIT_LIMIT 3';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 EXECUTE 2 HIT_LIMIT 3';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 EXECUTE 2';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 HIT_LIMIT 3';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 EXECUTE 2 HIT_LIMIT 3';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 EXECUTE 2';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 HIT_LIMIT 3';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1';
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2';
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 HIT_LIMIT 3';
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6';
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 EXECUTE 2 HIT_LIMIT 3';
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 EXECUTE 2';
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 HIT_LIMIT 3';
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2';
|
||||
SET DEBUG_SYNC='p0 HIT_LIMIT 3';
|
||||
SET DEBUG_SYNC='p0 CLEAR';
|
||||
SET DEBUG_SYNC='p0 TEST';
|
||||
SET DEBUG_SYNC='RESET';
|
||||
set debug_sync='p0 signal s1 wait_for s2 timeout 6 execute 2 hit_limit 3';
|
||||
set debug_sync='p0 signal s1 wait_for s2 timeout 6 execute 2';
|
||||
set debug_sync='p0 signal s1 wait_for s2 timeout 6 hit_limit 3';
|
||||
set debug_sync='p0 signal s1 wait_for s2 timeout 6';
|
||||
set debug_sync='p0 signal s1 wait_for s2 execute 2 hit_limit 3';
|
||||
set debug_sync='p0 signal s1 wait_for s2 execute 2';
|
||||
set debug_sync='p0 signal s1 wait_for s2 hit_limit 3';
|
||||
set debug_sync='p0 signal s1 wait_for s2';
|
||||
set debug_sync='p0 signal s1 execute 2 hit_limit 3';
|
||||
set debug_sync='p0 signal s1 execute 2';
|
||||
set debug_sync='p0 signal s1 hit_limit 3';
|
||||
set debug_sync='p0 signal s1';
|
||||
set debug_sync='p0 wait_for s2 timeout 6 execute 2 hit_limit 3';
|
||||
set debug_sync='p0 wait_for s2 timeout 6 execute 2';
|
||||
set debug_sync='p0 wait_for s2 timeout 6 hit_limit 3';
|
||||
set debug_sync='p0 wait_for s2 timeout 6';
|
||||
set debug_sync='p0 wait_for s2 execute 2 hit_limit 3';
|
||||
set debug_sync='p0 wait_for s2 execute 2';
|
||||
set debug_sync='p0 wait_for s2 hit_limit 3';
|
||||
set debug_sync='p0 wait_for s2';
|
||||
set debug_sync='p0 hit_limit 3';
|
||||
set debug_sync='p0 clear';
|
||||
set debug_sync='p0 test';
|
||||
set debug_sync='reset';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6
|
||||
EXECUTE 2 HIT_LIMIT 3';
|
||||
SET DEBUG_SYNC=' p0 SIGNAL s1 WAIT_FOR s2';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2';
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 ';
|
||||
SET DEBUG_SYNC=' p0 SIGNAL s1 WAIT_FOR s2 ';
|
||||
SET DEBUG_SYNC=' p0 SIGNAL s1 WAIT_FOR s2 ';
|
||||
SET DEBUG_SYNC='';
|
||||
ERROR 42000: Missing synchronization point name
|
||||
SET DEBUG_SYNC=' ';
|
||||
ERROR 42000: Missing synchronization point name
|
||||
SET DEBUG_SYNC='p0';
|
||||
ERROR 42000: Missing action after synchronization point name 'p0'
|
||||
SET DEBUG_SYNC='p0 EXECUTE 2';
|
||||
ERROR 42000: Missing action before EXECUTE
|
||||
SET DEBUG_SYNC='p0 TIMEOUT 6 EXECUTE 2';
|
||||
ERROR 42000: Illegal or out of order stuff: 'TIMEOUT'
|
||||
SET DEBUG_SYNC='p0 TIMEOUT 6';
|
||||
ERROR 42000: Illegal or out of order stuff: 'TIMEOUT'
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1';
|
||||
ERROR 42000: Illegal or out of order stuff: 'SIGNAL'
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1 EXECUTE 2';
|
||||
ERROR 42000: Illegal or out of order stuff: 'SIGNAL'
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1 TIMEOUT 6 EXECUTE 2';
|
||||
ERROR 42000: Illegal or out of order stuff: 'SIGNAL'
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1 TIMEOUT 6';
|
||||
ERROR 42000: Illegal or out of order stuff: 'SIGNAL'
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 SIGNAL s1 EXECUTE 2';
|
||||
ERROR 42000: Illegal or out of order stuff: 'SIGNAL'
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 SIGNAL s1';
|
||||
ERROR 42000: Illegal or out of order stuff: 'SIGNAL'
|
||||
SET DEBUG_SYNC='p0 TIMEOUT 6 WAIT_FOR s2 EXECUTE 2';
|
||||
ERROR 42000: Illegal or out of order stuff: 'TIMEOUT'
|
||||
SET DEBUG_SYNC='p0 TIMEOUT 6 WAIT_FOR s2';
|
||||
ERROR 42000: Illegal or out of order stuff: 'TIMEOUT'
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 TIMEOUT 6 EXECUTE 2';
|
||||
ERROR 42000: Illegal or out of order stuff: 'TIMEOUT'
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 TIMEOUT 6';
|
||||
ERROR 42000: Illegal or out of order stuff: 'TIMEOUT'
|
||||
SET DEBUG_SYNC='p0 EXECUTE 2 SIGNAL s1 TIMEOUT 6';
|
||||
ERROR 42000: Missing action before EXECUTE
|
||||
SET DEBUG_SYNC='p0 TIMEOUT 6 SIGNAL s1';
|
||||
ERROR 42000: Illegal or out of order stuff: 'TIMEOUT'
|
||||
SET DEBUG_SYNC='p0 EXECUTE 2 TIMEOUT 6 SIGNAL s1';
|
||||
ERROR 42000: Missing action before EXECUTE
|
||||
SET DEBUG_SYNC='p0 CLEAR HIT_LIMIT 3';
|
||||
ERROR 42000: Nothing must follow action CLEAR
|
||||
SET DEBUG_SYNC='CLEAR';
|
||||
ERROR 42000: Missing action after synchronization point name 'CLEAR'
|
||||
SET DEBUG_SYNC='p0 CLEAR p0';
|
||||
ERROR 42000: Nothing must follow action CLEAR
|
||||
SET DEBUG_SYNC='TEST';
|
||||
ERROR 42000: Missing action after synchronization point name 'TEST'
|
||||
SET DEBUG_SYNC='p0 TEST p0';
|
||||
ERROR 42000: Nothing must follow action TEST
|
||||
SET DEBUG_SYNC='p0 RESET';
|
||||
ERROR 42000: Illegal or out of order stuff: 'RESET'
|
||||
SET DEBUG_SYNC='RESET p0';
|
||||
ERROR 42000: Illegal or out of order stuff: 'p0'
|
||||
SET DEBUG_SYNC='p0 RESET p0';
|
||||
ERROR 42000: Illegal or out of order stuff: 'RESET'
|
||||
SET DEBUG_SYNC='p0 SIGNAL ';
|
||||
ERROR 42000: Missing signal name after action SIGNAL
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR ';
|
||||
ERROR 42000: Missing signal name after action WAIT_FOR
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 EXECUTE ';
|
||||
ERROR 42000: Missing valid number after EXECUTE
|
||||
SET DEBUG_SYNCx='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
|
||||
ERROR HY000: Unknown system variable 'DEBUG_SYNCx'
|
||||
SET DEBUG_SYNC='p0 SIGNAx s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
|
||||
ERROR 42000: Illegal or out of order stuff: 'SIGNAx'
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOx s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
|
||||
ERROR 42000: Illegal or out of order stuff: 'WAIT_FOx'
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUx 0 EXECUTE 2 HIT_LIMIT 3';
|
||||
ERROR 42000: Illegal or out of order stuff: 'TIMEOUx'
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTx 2 HIT_LIMIT 3';
|
||||
ERROR 42000: Illegal or out of order stuff: 'EXECUTx'
|
||||
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIx 3';
|
||||
ERROR 42000: Illegal or out of order stuff: 'HIT_LIMIx'
|
||||
SET DEBUG_SYNC='p0 CLEARx';
|
||||
ERROR 42000: Illegal or out of order stuff: 'CLEARx'
|
||||
SET DEBUG_SYNC='p0 TESTx';
|
||||
ERROR 42000: Illegal or out of order stuff: 'TESTx'
|
||||
SET DEBUG_SYNC='RESETx';
|
||||
ERROR 42000: Missing action after synchronization point name 'RESETx'
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 0x6 EXECUTE 2 HIT_LIMIT 3';
|
||||
ERROR 42000: Missing valid number after TIMEOUT
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 EXECUTE 0x2 HIT_LIMIT 3';
|
||||
ERROR 42000: Missing valid number after EXECUTE
|
||||
SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 7 EXECUTE 2 HIT_LIMIT 0x3';
|
||||
ERROR 42000: Missing valid number after HIT_LIMIT
|
||||
SET DEBUG_SYNC= 7;
|
||||
ERROR 42000: Incorrect argument type to variable 'debug_sync'
|
||||
SET GLOBAL DEBUG_SYNC= 'p0 CLEAR';
|
||||
ERROR HY000: Variable 'debug_sync' is a SESSION variable and can't be used with SET GLOBAL
|
||||
SET @myvar= 'now SIGNAL from_myvar';
|
||||
SET DEBUG_SYNC= @myvar;
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
Variable_name Value
|
||||
debug_sync ON - current signal: 'from_myvar'
|
||||
SET DEBUG_SYNC= LEFT('now SIGNAL from_function_cut_here', 24);
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
Variable_name Value
|
||||
debug_sync ON - current signal: 'from_function'
|
||||
SET DEBUG_SYNC= 'now SIGNAL something';
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
Variable_name Value
|
||||
debug_sync ON - current signal: 'something'
|
||||
SET DEBUG_SYNC= 'now WAIT_FOR nothing TIMEOUT 0';
|
||||
Warnings:
|
||||
Warning #### debug sync point wait timed out
|
||||
SET DEBUG_SYNC= 'now SIGNAL nothing';
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
Variable_name Value
|
||||
debug_sync ON - current signal: 'nothing'
|
||||
SET DEBUG_SYNC= 'now WAIT_FOR nothing TIMEOUT 0';
|
||||
SET DEBUG_SYNC= 'now SIGNAL something EXECUTE 0';
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
Variable_name Value
|
||||
debug_sync ON - current signal: 'nothing'
|
||||
SET DEBUG_SYNC= 'now WAIT_FOR anotherthing TIMEOUT 0 EXECUTE 0';
|
||||
SET DEBUG_SYNC= 'now HIT_LIMIT 1';
|
||||
ERROR HY000: debug sync point hit limit reached
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
Variable_name Value
|
||||
debug_sync ON - current signal: ''
|
||||
SET DEBUG_SYNC= 'p1abcd SIGNAL s1 EXECUTE 2';
|
||||
SET DEBUG_SYNC= 'p2abc SIGNAL s2 EXECUTE 2';
|
||||
SET DEBUG_SYNC= 'p9abcdef SIGNAL s9 EXECUTE 2';
|
||||
SET DEBUG_SYNC= 'p4a SIGNAL s4 EXECUTE 2';
|
||||
SET DEBUG_SYNC= 'p5abcde SIGNAL s5 EXECUTE 2';
|
||||
SET DEBUG_SYNC= 'p6ab SIGNAL s6 EXECUTE 2';
|
||||
SET DEBUG_SYNC= 'p7 SIGNAL s7 EXECUTE 2';
|
||||
SET DEBUG_SYNC= 'p8abcdef SIGNAL s8 EXECUTE 2';
|
||||
SET DEBUG_SYNC= 'p3abcdef SIGNAL s3 EXECUTE 2';
|
||||
SET DEBUG_SYNC= 'p4a TEST';
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
Variable_name Value
|
||||
debug_sync ON - current signal: 's4'
|
||||
SET DEBUG_SYNC= 'p1abcd TEST';
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
Variable_name Value
|
||||
debug_sync ON - current signal: 's1'
|
||||
SET DEBUG_SYNC= 'p7 TEST';
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
Variable_name Value
|
||||
debug_sync ON - current signal: 's7'
|
||||
SET DEBUG_SYNC= 'p9abcdef TEST';
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
Variable_name Value
|
||||
debug_sync ON - current signal: 's9'
|
||||
SET DEBUG_SYNC= 'p3abcdef TEST';
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
Variable_name Value
|
||||
debug_sync ON - current signal: 's3'
|
||||
SET DEBUG_SYNC= 'p1abcd CLEAR';
|
||||
SET DEBUG_SYNC= 'p2abc CLEAR';
|
||||
SET DEBUG_SYNC= 'p5abcde CLEAR';
|
||||
SET DEBUG_SYNC= 'p6ab CLEAR';
|
||||
SET DEBUG_SYNC= 'p8abcdef CLEAR';
|
||||
SET DEBUG_SYNC= 'p9abcdef CLEAR';
|
||||
SET DEBUG_SYNC= 'p3abcdef CLEAR';
|
||||
SET DEBUG_SYNC= 'p4a CLEAR';
|
||||
SET DEBUG_SYNC= 'p7 CLEAR';
|
||||
SET DEBUG_SYNC= 'p1abcd TEST';
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
Variable_name Value
|
||||
debug_sync ON - current signal: 's3'
|
||||
SET DEBUG_SYNC= 'p7 TEST';
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
Variable_name Value
|
||||
debug_sync ON - current signal: 's3'
|
||||
SET DEBUG_SYNC= 'p9abcdef TEST';
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
Variable_name Value
|
||||
debug_sync ON - current signal: 's3'
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
SHOW VARIABLES LIKE 'DEBUG_SYNC';
|
||||
Variable_name Value
|
||||
debug_sync ON - current signal: ''
|
||||
CREATE USER mysqltest_1@localhost;
|
||||
GRANT SUPER ON *.* TO mysqltest_1@localhost;
|
||||
connection con1, mysqltest_1
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
connection default
|
||||
DROP USER mysqltest_1@localhost;
|
||||
CREATE USER mysqltest_2@localhost;
|
||||
GRANT ALL ON *.* TO mysqltest_2@localhost;
|
||||
REVOKE SUPER ON *.* FROM mysqltest_2@localhost;
|
||||
connection con1, mysqltest_2
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
ERROR 42000: Access denied; you need the SUPER privilege for this operation
|
||||
connection default
|
||||
DROP USER mysqltest_2@localhost;
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (c1 INT);
|
||||
connection con1
|
||||
SET DEBUG_SYNC= 'before_lock_tables_takes_lock
|
||||
SIGNAL opened WAIT_FOR flushed';
|
||||
INSERT INTO t1 VALUES(1);
|
||||
connection default
|
||||
SET DEBUG_SYNC= 'now WAIT_FOR opened';
|
||||
SET DEBUG_SYNC= 'after_flush_unlock SIGNAL flushed';
|
||||
FLUSH TABLE t1;
|
||||
connection con1
|
||||
connection default
|
||||
DROP TABLE t1;
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (c1 INT);
|
||||
LOCK TABLE t1 WRITE;
|
||||
connection con1
|
||||
SET DEBUG_SYNC= 'wait_for_lock SIGNAL locked EXECUTE 2';
|
||||
INSERT INTO t1 VALUES (1);
|
||||
connection default
|
||||
SET DEBUG_SYNC= 'now WAIT_FOR locked';
|
||||
UNLOCK TABLES;
|
||||
connection con1
|
||||
retrieve INSERT result.
|
||||
connection default
|
||||
DROP TABLE t1;
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
222
build/lib/mysql/mysql-test/r/default.result
Normal file
222
build/lib/mysql/mysql-test/r/default.result
Normal file
@@ -0,0 +1,222 @@
|
||||
drop table if exists t1,t2,t3,t4,t5,t6;
|
||||
drop database if exists mysqltest;
|
||||
CREATE TABLE t1 (a varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
b varchar(1) binary NOT NULL DEFAULT ' ',
|
||||
c varchar(4) binary NOT NULL DEFAULT '0000',
|
||||
d tinyblob NULL,
|
||||
e tinyblob NULL,
|
||||
f tinyblob NULL,
|
||||
g tinyblob NULL,
|
||||
h tinyblob NULL,
|
||||
i tinyblob NULL,
|
||||
j tinyblob NULL,
|
||||
k tinyblob NULL,
|
||||
l tinyblob NULL,
|
||||
m tinyblob NULL,
|
||||
n tinyblob NULL,
|
||||
o tinyblob NULL,
|
||||
p tinyblob NULL,
|
||||
q varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
r varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
s tinyblob NULL,
|
||||
t varchar(4) binary NOT NULL DEFAULT ' ',
|
||||
u varchar(1) binary NOT NULL DEFAULT ' ',
|
||||
v varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
w varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
x tinyblob NULL,
|
||||
y varchar(5) binary NOT NULL DEFAULT ' ',
|
||||
z varchar(20) binary NOT NULL DEFAULT ' ',
|
||||
a1 varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
b1 tinyblob NULL)
|
||||
ENGINE=InnoDB DEFAULT CHARACTER SET = latin1 COLLATE latin1_bin;
|
||||
INSERT into t1 (b) values ('1');
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
SELECT * from t1;
|
||||
a b c d e f g h i j k l m n o p q r s t u v w x y z a1 b1
|
||||
1 0000 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
CREATE TABLE t2 (a varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
b varchar(1) binary NOT NULL DEFAULT ' ',
|
||||
c varchar(4) binary NOT NULL DEFAULT '0000',
|
||||
d tinyblob NULL,
|
||||
e tinyblob NULL,
|
||||
f tinyblob NULL,
|
||||
g tinyblob NULL,
|
||||
h tinyblob NULL,
|
||||
i tinyblob NULL,
|
||||
j tinyblob NULL,
|
||||
k tinyblob NULL,
|
||||
l tinyblob NULL,
|
||||
m tinyblob NULL,
|
||||
n tinyblob NULL,
|
||||
o tinyblob NULL,
|
||||
p tinyblob NULL,
|
||||
q varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
r varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
s tinyblob NULL,
|
||||
t varchar(4) binary NOT NULL DEFAULT ' ',
|
||||
u varchar(1) binary NOT NULL DEFAULT ' ',
|
||||
v varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
w varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
x tinyblob NULL,
|
||||
y varchar(5) binary NOT NULL DEFAULT ' ',
|
||||
z varchar(20) binary NOT NULL DEFAULT ' ',
|
||||
a1 varchar(30) binary NOT NULL DEFAULT ' ',
|
||||
b1 tinyblob NULL)
|
||||
ENGINE=MyISAM DEFAULT CHARACTER SET = latin1 COLLATE latin1_bin;
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`a` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ',
|
||||
`b` varchar(1) COLLATE latin1_bin NOT NULL DEFAULT ' ',
|
||||
`c` varchar(4) COLLATE latin1_bin NOT NULL DEFAULT '0000',
|
||||
`d` tinyblob,
|
||||
`e` tinyblob,
|
||||
`f` tinyblob,
|
||||
`g` tinyblob,
|
||||
`h` tinyblob,
|
||||
`i` tinyblob,
|
||||
`j` tinyblob,
|
||||
`k` tinyblob,
|
||||
`l` tinyblob,
|
||||
`m` tinyblob,
|
||||
`n` tinyblob,
|
||||
`o` tinyblob,
|
||||
`p` tinyblob,
|
||||
`q` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ',
|
||||
`r` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ',
|
||||
`s` tinyblob,
|
||||
`t` varchar(4) COLLATE latin1_bin NOT NULL DEFAULT ' ',
|
||||
`u` varchar(1) COLLATE latin1_bin NOT NULL DEFAULT ' ',
|
||||
`v` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ',
|
||||
`w` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ',
|
||||
`x` tinyblob,
|
||||
`y` varchar(5) COLLATE latin1_bin NOT NULL DEFAULT ' ',
|
||||
`z` varchar(20) COLLATE latin1_bin NOT NULL DEFAULT ' ',
|
||||
`a1` varchar(30) COLLATE latin1_bin NOT NULL DEFAULT ' ',
|
||||
`b1` tinyblob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin
|
||||
INSERT into t2 (b) values ('1');
|
||||
SHOW WARNINGS;
|
||||
Level Code Message
|
||||
SELECT * from t2;
|
||||
a b c d e f g h i j k l m n o p q r s t u v w x y z a1 b1
|
||||
1 0000 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
create table bug20691 (i int, d datetime NOT NULL, dn datetime not null default '0000-00-00 00:00:00');
|
||||
insert into bug20691 values (1, DEFAULT, DEFAULT), (1, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (1, DEFAULT, DEFAULT);
|
||||
Warnings:
|
||||
Warning 1364 Field 'd' doesn't have a default value
|
||||
Warning 1364 Field 'd' doesn't have a default value
|
||||
insert into bug20691 (i) values (2);
|
||||
Warnings:
|
||||
Warning 1364 Field 'd' doesn't have a default value
|
||||
desc bug20691;
|
||||
Field Type Null Key Default Extra
|
||||
i int(11) YES NULL
|
||||
d datetime NO NULL
|
||||
dn datetime NO 0000-00-00 00:00:00
|
||||
insert into bug20691 values (3, DEFAULT, DEFAULT), (3, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (3, DEFAULT, DEFAULT);
|
||||
Warnings:
|
||||
Warning 1364 Field 'd' doesn't have a default value
|
||||
Warning 1364 Field 'd' doesn't have a default value
|
||||
insert into bug20691 (i) values (4);
|
||||
Warnings:
|
||||
Warning 1364 Field 'd' doesn't have a default value
|
||||
insert into bug20691 values (5, DEFAULT, DEFAULT), (5, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (5, DEFAULT, DEFAULT);
|
||||
Warnings:
|
||||
Warning 1364 Field 'd' doesn't have a default value
|
||||
Warning 1364 Field 'd' doesn't have a default value
|
||||
SET sql_mode = 'ALLOW_INVALID_DATES';
|
||||
insert into bug20691 values (6, DEFAULT, DEFAULT), (6, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (6, DEFAULT, DEFAULT);
|
||||
Warnings:
|
||||
Warning 1364 Field 'd' doesn't have a default value
|
||||
Warning 1364 Field 'd' doesn't have a default value
|
||||
SET sql_mode = 'STRICT_ALL_TABLES';
|
||||
insert into bug20691 values (7, DEFAULT, DEFAULT), (7, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (7, DEFAULT, DEFAULT);
|
||||
ERROR HY000: Field 'd' doesn't have a default value
|
||||
select * from bug20691 order by i asc;
|
||||
i d dn
|
||||
1 0000-00-00 00:00:00 0000-00-00 00:00:00
|
||||
1 1975-07-10 07:10:03 1978-01-13 14:08:51
|
||||
1 0000-00-00 00:00:00 0000-00-00 00:00:00
|
||||
2 0000-00-00 00:00:00 0000-00-00 00:00:00
|
||||
3 0000-00-00 00:00:00 0000-00-00 00:00:00
|
||||
3 1975-07-10 07:10:03 1978-01-13 14:08:51
|
||||
3 0000-00-00 00:00:00 0000-00-00 00:00:00
|
||||
4 0000-00-00 00:00:00 0000-00-00 00:00:00
|
||||
5 0000-00-00 00:00:00 0000-00-00 00:00:00
|
||||
5 1975-07-10 07:10:03 1978-01-13 14:08:51
|
||||
5 0000-00-00 00:00:00 0000-00-00 00:00:00
|
||||
6 0000-00-00 00:00:00 0000-00-00 00:00:00
|
||||
6 1975-07-10 07:10:03 1978-01-13 14:08:51
|
||||
6 0000-00-00 00:00:00 0000-00-00 00:00:00
|
||||
drop table bug20691;
|
||||
SET sql_mode = '';
|
||||
create table bug20691 (
|
||||
a set('one', 'two', 'three') not null,
|
||||
b enum('small', 'medium', 'large', 'enormous', 'ellisonego') not null,
|
||||
c time not null,
|
||||
d date not null,
|
||||
e int not null,
|
||||
f long not null,
|
||||
g blob not null,
|
||||
h datetime not null,
|
||||
i decimal not null,
|
||||
x int);
|
||||
insert into bug20691 values (2, 3, 5, '0007-01-01', 11, 13, 17, '0019-01-01 00:00:00', 23, 1);
|
||||
insert into bug20691 (x) values (2);
|
||||
Warnings:
|
||||
Warning 1364 Field 'a' doesn't have a default value
|
||||
Warning 1364 Field 'c' doesn't have a default value
|
||||
Warning 1364 Field 'd' doesn't have a default value
|
||||
Warning 1364 Field 'e' doesn't have a default value
|
||||
Warning 1364 Field 'f' doesn't have a default value
|
||||
Warning 1364 Field 'g' doesn't have a default value
|
||||
Warning 1364 Field 'h' doesn't have a default value
|
||||
Warning 1364 Field 'i' doesn't have a default value
|
||||
insert into bug20691 values (2, 3, 5, '0007-01-01', 11, 13, 17, '0019-01-01 00:00:00', 23, 3);
|
||||
insert into bug20691 values (DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, 4);
|
||||
Warnings:
|
||||
Warning 1364 Field 'a' doesn't have a default value
|
||||
Warning 1364 Field 'c' doesn't have a default value
|
||||
Warning 1364 Field 'd' doesn't have a default value
|
||||
Warning 1364 Field 'e' doesn't have a default value
|
||||
Warning 1364 Field 'f' doesn't have a default value
|
||||
Warning 1364 Field 'g' doesn't have a default value
|
||||
Warning 1364 Field 'h' doesn't have a default value
|
||||
Warning 1364 Field 'i' doesn't have a default value
|
||||
select * from bug20691 order by x asc;
|
||||
a b c d e f g h i x
|
||||
two large 00:00:05 0007-01-01 11 13 17 0019-01-01 00:00:00 23 1
|
||||
small 00:00:00 0000-00-00 0 0000-00-00 00:00:00 0 2
|
||||
two large 00:00:05 0007-01-01 11 13 17 0019-01-01 00:00:00 23 3
|
||||
small 00:00:00 0000-00-00 0 0000-00-00 00:00:00 0 4
|
||||
drop table bug20691;
|
||||
create table t1 (id int not null);
|
||||
insert into t1 values(default);
|
||||
Warnings:
|
||||
Warning 1364 Field 'id' doesn't have a default value
|
||||
create view v1 (c) as select id from t1;
|
||||
insert into t1 values(default);
|
||||
Warnings:
|
||||
Warning 1364 Field 'id' doesn't have a default value
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
create table t1 (a int unique);
|
||||
create table t2 (b int default 10);
|
||||
insert into t1 (a) values (1);
|
||||
insert into t2 (b) values (1);
|
||||
insert into t1 (a) select b from t2 on duplicate key update a=default;
|
||||
select * from t1;
|
||||
a
|
||||
NULL
|
||||
insert into t1 (a) values (1);
|
||||
insert into t1 (a) select b from t2 on duplicate key update a=default(b);
|
||||
select * from t1;
|
||||
a
|
||||
NULL
|
||||
10
|
||||
drop table t1, t2;
|
||||
End of 5.0 tests.
|
||||
325
build/lib/mysql/mysql-test/r/delayed.result
Normal file
325
build/lib/mysql/mysql-test/r/delayed.result
Normal file
@@ -0,0 +1,325 @@
|
||||
drop table if exists t1;
|
||||
create table t1 (a char(10), tmsp timestamp);
|
||||
insert into t1 set a = 1;
|
||||
insert delayed into t1 set a = 2;
|
||||
insert into t1 set a = 3, tmsp=NULL;
|
||||
insert delayed into t1 set a = 4;
|
||||
insert delayed into t1 set a = 5, tmsp = 19711006010203;
|
||||
insert delayed into t1 (a, tmsp) values (6, 19711006010203);
|
||||
insert delayed into t1 (a, tmsp) values (7, NULL);
|
||||
FLUSH TABLE t1;
|
||||
insert into t1 set a = 8,tmsp=19711006010203;
|
||||
select * from t1 where tmsp=0;
|
||||
a tmsp
|
||||
select * from t1 where tmsp=19711006010203;
|
||||
a tmsp
|
||||
5 1971-10-06 01:02:03
|
||||
6 1971-10-06 01:02:03
|
||||
8 1971-10-06 01:02:03
|
||||
drop table t1;
|
||||
create table t1 (a int not null auto_increment primary key, b char(10));
|
||||
insert delayed into t1 values (1,"b");
|
||||
insert delayed into t1 values (null,"c");
|
||||
insert delayed into t1 values (3,"d"),(null,"e");
|
||||
insert delayed into t1 values (3,"this will give an","error");
|
||||
ERROR 21S01: Column count doesn't match value count at row 1
|
||||
FLUSH TABLE t1;
|
||||
show status like 'not_flushed_delayed_rows';
|
||||
Variable_name Value
|
||||
Not_flushed_delayed_rows 0
|
||||
select * from t1;
|
||||
a b
|
||||
1 b
|
||||
2 c
|
||||
3 d
|
||||
4 e
|
||||
drop table t1;
|
||||
create table t1 (a int not null primary key);
|
||||
insert into t1 values (1);
|
||||
insert delayed into t1 values (1);
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( a int(10) NOT NULL auto_increment, PRIMARY KEY (a));
|
||||
insert delayed into t1 values(null);
|
||||
insert into t1 values(null);
|
||||
insert into t1 values(null);
|
||||
insert delayed into t1 values(null);
|
||||
insert delayed into t1 values(null);
|
||||
insert delayed into t1 values(null);
|
||||
insert into t1 values(null);
|
||||
insert into t1 values(null);
|
||||
insert into t1 values(null);
|
||||
delete from t1 where a=6;
|
||||
insert delayed into t1 values(null);
|
||||
insert delayed into t1 values(null);
|
||||
insert delayed into t1 values(null);
|
||||
insert delayed into t1 values(null);
|
||||
FLUSH TABLE t1;
|
||||
select * from t1 order by a;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
DROP TABLE t1;
|
||||
SET @bug20627_old_auto_increment_offset=
|
||||
@@auto_increment_offset;
|
||||
SET @bug20627_old_auto_increment_increment=
|
||||
@@auto_increment_increment;
|
||||
SET @bug20627_old_session_auto_increment_offset=
|
||||
@@session.auto_increment_offset;
|
||||
SET @bug20627_old_session_auto_increment_increment=
|
||||
@@session.auto_increment_increment;
|
||||
SET @@auto_increment_offset= 2;
|
||||
SET @@auto_increment_increment= 3;
|
||||
SET @@session.auto_increment_offset= 4;
|
||||
SET @@session.auto_increment_increment= 5;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1)
|
||||
);
|
||||
INSERT INTO t1 VALUES (NULL),(NULL),(NULL);
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
4
|
||||
9
|
||||
14
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (c1)
|
||||
);
|
||||
INSERT DELAYED INTO t1 VALUES (NULL),(NULL),(NULL);
|
||||
FLUSH TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
4
|
||||
9
|
||||
14
|
||||
DROP TABLE t1;
|
||||
SET @@auto_increment_offset=
|
||||
@bug20627_old_auto_increment_offset;
|
||||
SET @@auto_increment_increment=
|
||||
@bug20627_old_auto_increment_increment;
|
||||
SET @@session.auto_increment_offset=
|
||||
@bug20627_old_session_auto_increment_offset;
|
||||
SET @@session.auto_increment_increment=
|
||||
@bug20627_old_session_auto_increment_increment;
|
||||
SET @bug20830_old_auto_increment_offset=
|
||||
@@auto_increment_offset;
|
||||
SET @bug20830_old_auto_increment_increment=
|
||||
@@auto_increment_increment;
|
||||
SET @bug20830_old_session_auto_increment_offset=
|
||||
@@session.auto_increment_offset;
|
||||
SET @bug20830_old_session_auto_increment_increment=
|
||||
@@session.auto_increment_increment;
|
||||
SET @@auto_increment_offset= 2;
|
||||
SET @@auto_increment_increment= 3;
|
||||
SET @@session.auto_increment_offset= 4;
|
||||
SET @@session.auto_increment_increment= 5;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT(11) NOT NULL AUTO_INCREMENT,
|
||||
c2 INT(11) DEFAULT NULL,
|
||||
PRIMARY KEY (c1)
|
||||
);
|
||||
SET insert_id= 14;
|
||||
INSERT INTO t1 VALUES(NULL, 11), (NULL, 12), (NULL, 13);
|
||||
INSERT INTO t1 VALUES(NULL, 21), (NULL, 22), (NULL, 23);
|
||||
INSERT INTO t1 VALUES( 69, 31), (NULL, 32), (NULL, 33);
|
||||
INSERT INTO t1 VALUES(NULL, 41), (NULL, 42), (NULL, 43);
|
||||
SET insert_id= 114;
|
||||
INSERT INTO t1 VALUES(NULL, 51), (NULL, 52), (NULL, 53);
|
||||
INSERT INTO t1 VALUES(NULL, 61), (NULL, 62), (NULL, 63);
|
||||
INSERT INTO t1 VALUES( 49, 71), (NULL, 72), (NULL, 73);
|
||||
INSERT INTO t1 VALUES(NULL, 81), (NULL, 82), (NULL, 83);
|
||||
SET insert_id= 114;
|
||||
INSERT INTO t1 VALUES(NULL, 91);
|
||||
ERROR 23000: Duplicate entry '114' for key 'PRIMARY'
|
||||
INSERT INTO t1 VALUES (NULL, 92), (NULL, 93);
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
14 11
|
||||
19 12
|
||||
24 13
|
||||
29 21
|
||||
34 22
|
||||
39 23
|
||||
69 31
|
||||
74 32
|
||||
79 33
|
||||
84 41
|
||||
89 42
|
||||
94 43
|
||||
114 51
|
||||
119 52
|
||||
124 53
|
||||
129 61
|
||||
134 62
|
||||
139 63
|
||||
49 71
|
||||
144 72
|
||||
149 73
|
||||
154 81
|
||||
159 82
|
||||
164 83
|
||||
169 92
|
||||
174 93
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
26
|
||||
SELECT SUM(c1) FROM t1;
|
||||
SUM(c1)
|
||||
2569
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT(11) NOT NULL AUTO_INCREMENT,
|
||||
c2 INT(11) DEFAULT NULL,
|
||||
PRIMARY KEY (c1)
|
||||
);
|
||||
SET insert_id= 14;
|
||||
INSERT DELAYED INTO t1 VALUES(NULL, 11), (NULL, 12), (NULL, 13);
|
||||
INSERT DELAYED INTO t1 VALUES(NULL, 21), (NULL, 22), (NULL, 23);
|
||||
INSERT DELAYED INTO t1 VALUES( 69, 31), (NULL, 32), (NULL, 33);
|
||||
INSERT DELAYED INTO t1 VALUES(NULL, 41), (NULL, 42), (NULL, 43);
|
||||
SET insert_id= 114;
|
||||
INSERT DELAYED INTO t1 VALUES(NULL, 51), (NULL, 52), (NULL, 53);
|
||||
INSERT DELAYED INTO t1 VALUES(NULL, 61), (NULL, 62), (NULL, 63);
|
||||
INSERT DELAYED INTO t1 VALUES( 49, 71), (NULL, 72), (NULL, 73);
|
||||
INSERT DELAYED INTO t1 VALUES(NULL, 81), (NULL, 82), (NULL, 83);
|
||||
SET insert_id= 114;
|
||||
INSERT DELAYED INTO t1 VALUES(NULL, 91);
|
||||
INSERT DELAYED INTO t1 VALUES (NULL, 92), (NULL, 93);
|
||||
FLUSH TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
14 11
|
||||
19 12
|
||||
24 13
|
||||
29 21
|
||||
34 22
|
||||
39 23
|
||||
69 31
|
||||
74 32
|
||||
79 33
|
||||
84 41
|
||||
89 42
|
||||
94 43
|
||||
114 51
|
||||
119 52
|
||||
124 53
|
||||
129 61
|
||||
134 62
|
||||
139 63
|
||||
49 71
|
||||
144 72
|
||||
149 73
|
||||
154 81
|
||||
159 82
|
||||
164 83
|
||||
169 92
|
||||
174 93
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
26
|
||||
SELECT SUM(c1) FROM t1;
|
||||
SUM(c1)
|
||||
2569
|
||||
DROP TABLE t1;
|
||||
SET @@auto_increment_offset=
|
||||
@bug20830_old_auto_increment_offset;
|
||||
SET @@auto_increment_increment=
|
||||
@bug20830_old_auto_increment_increment;
|
||||
SET @@session.auto_increment_offset=
|
||||
@bug20830_old_session_auto_increment_offset;
|
||||
SET @@session.auto_increment_increment=
|
||||
@bug20830_old_session_auto_increment_increment;
|
||||
CREATE TABLE t1(a BIT);
|
||||
INSERT DELAYED INTO t1 VALUES(1);
|
||||
FLUSH TABLE t1;
|
||||
SELECT HEX(a) FROM t1;
|
||||
HEX(a)
|
||||
1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT DELAYED INTO t1 SET b= b();
|
||||
ERROR 42S22: Unknown column 'b' in 'field list'
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
DROP TABLE IF EXISTS t1,t2;
|
||||
SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO';
|
||||
CREATE TABLE `t1` (
|
||||
`id` int(11) PRIMARY KEY auto_increment,
|
||||
`f1` varchar(10) NOT NULL UNIQUE
|
||||
);
|
||||
INSERT DELAYED INTO t1 VALUES(0,"test1");
|
||||
SELECT * FROM t1;
|
||||
id f1
|
||||
0 test1
|
||||
SET SQL_MODE='PIPES_AS_CONCAT';
|
||||
INSERT DELAYED INTO t1 VALUES(0,'a' || 'b');
|
||||
SELECT * FROM t1;
|
||||
id f1
|
||||
0 test1
|
||||
1 ab
|
||||
SET SQL_MODE='ERROR_FOR_DIVISION_BY_ZERO,STRICT_ALL_TABLES';
|
||||
INSERT DELAYED INTO t1 VALUES(mod(1,0),"test3");
|
||||
ERROR 22012: Division by 0
|
||||
CREATE TABLE t2 (
|
||||
`id` int(11) PRIMARY KEY auto_increment,
|
||||
`f1` date
|
||||
);
|
||||
SET SQL_MODE='NO_ZERO_DATE,STRICT_ALL_TABLES,NO_ZERO_IN_DATE';
|
||||
INSERT DELAYED INTO t2 VALUES (0,'0000-00-00');
|
||||
ERROR 22007: Incorrect date value: '0000-00-00' for column 'f1' at row 1
|
||||
INSERT DELAYED INTO t2 VALUES (0,'2007-00-00');
|
||||
ERROR 22007: Incorrect date value: '2007-00-00' for column 'f1' at row 1
|
||||
DROP TABLE t1,t2;
|
||||
set @old_delayed_updates = @@global.low_priority_updates;
|
||||
set global low_priority_updates = 1;
|
||||
select @@global.low_priority_updates;
|
||||
@@global.low_priority_updates
|
||||
1
|
||||
drop table if exists t1;
|
||||
create table t1 (a int, b int);
|
||||
insert into t1 values (1,1);
|
||||
lock table t1 read;
|
||||
connection: update
|
||||
insert delayed into t1 values (2,2);;
|
||||
connection: select
|
||||
select * from t1;
|
||||
a b
|
||||
1 1
|
||||
connection: default
|
||||
select * from t1;
|
||||
a b
|
||||
1 1
|
||||
unlock tables;
|
||||
select * from t1;
|
||||
a b
|
||||
1 1
|
||||
2 2
|
||||
drop table t1;
|
||||
set global low_priority_updates = @old_delayed_updates;
|
||||
#
|
||||
# Bug #47682 strange behaviour of INSERT DELAYED
|
||||
#
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
CREATE TABLE t1 (f1 integer);
|
||||
CREATE TABLE t2 (f1 integer);
|
||||
FLUSH TABLES WITH READ LOCK;
|
||||
LOCK TABLES t1 READ;
|
||||
INSERT DELAYED INTO t2 VALUES (1);
|
||||
Got one of the listed errors
|
||||
UNLOCK TABLES;
|
||||
DROP TABLE t1, t2;
|
||||
End of 5.1 tests
|
||||
370
build/lib/mysql/mysql-test/r/delete.result
Normal file
370
build/lib/mysql/mysql-test/r/delete.result
Normal file
@@ -0,0 +1,370 @@
|
||||
drop table if exists t1,t2,t3,t11,t12;
|
||||
CREATE TABLE t1 (a tinyint(3), b tinyint(5));
|
||||
INSERT INTO t1 VALUES (1,1);
|
||||
INSERT LOW_PRIORITY INTO t1 VALUES (1,2);
|
||||
INSERT INTO t1 VALUES (1,3);
|
||||
DELETE from t1 where a=1 limit 1;
|
||||
DELETE LOW_PRIORITY from t1 where a=1;
|
||||
INSERT INTO t1 VALUES (1,1);
|
||||
DELETE from t1;
|
||||
LOCK TABLE t1 write;
|
||||
INSERT INTO t1 VALUES (1,2);
|
||||
DELETE from t1;
|
||||
UNLOCK TABLES;
|
||||
INSERT INTO t1 VALUES (1,2);
|
||||
SET AUTOCOMMIT=0;
|
||||
DELETE from t1;
|
||||
SET AUTOCOMMIT=1;
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
a bigint not null,
|
||||
b bigint not null default 0,
|
||||
c bigint not null default 0,
|
||||
d bigint not null default 0,
|
||||
e bigint not null default 0,
|
||||
f bigint not null default 0,
|
||||
g bigint not null default 0,
|
||||
h bigint not null default 0,
|
||||
i bigint not null default 0,
|
||||
j bigint not null default 0,
|
||||
primary key (a,b,c,d,e,f,g,h,i,j));
|
||||
insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23);
|
||||
delete from t1 where a=26;
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
a bigint not null,
|
||||
b bigint not null default 0,
|
||||
c bigint not null default 0,
|
||||
d bigint not null default 0,
|
||||
e bigint not null default 0,
|
||||
f bigint not null default 0,
|
||||
g bigint not null default 0,
|
||||
h bigint not null default 0,
|
||||
i bigint not null default 0,
|
||||
j bigint not null default 0,
|
||||
primary key (a,b,c,d,e,f,g,h,i,j));
|
||||
insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
|
||||
delete from t1 where a=27;
|
||||
drop table t1;
|
||||
CREATE TABLE `t1` (
|
||||
`i` int(10) NOT NULL default '0',
|
||||
`i2` int(10) NOT NULL default '0',
|
||||
PRIMARY KEY (`i`)
|
||||
);
|
||||
DELETE FROM t1 USING t1 WHERE post='1';
|
||||
ERROR 42S22: Unknown column 'post' in 'where clause'
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
bool char(0) default NULL,
|
||||
not_null varchar(20) binary NOT NULL default '',
|
||||
misc integer not null,
|
||||
PRIMARY KEY (not_null)
|
||||
) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (NULL,'a',4), (NULL,'b',5), (NULL,'c',6), (NULL,'d',7);
|
||||
select * from t1 where misc > 5 and bool is null;
|
||||
bool not_null misc
|
||||
NULL c 6
|
||||
NULL d 7
|
||||
delete from t1 where misc > 5 and bool is null;
|
||||
select * from t1 where misc > 5 and bool is null;
|
||||
bool not_null misc
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2
|
||||
delete from t1 where 1 > 2;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2
|
||||
delete from t1 where 3 > 2;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
drop table t1;
|
||||
create table t1 (a int not null auto_increment primary key, b char(32));
|
||||
insert into t1 (b) values ('apple'), ('apple');
|
||||
select * from t1;
|
||||
a b
|
||||
1 apple
|
||||
2 apple
|
||||
delete t1 from t1, t1 as t2 where t1.b = t2.b and t1.a > t2.a;
|
||||
select * from t1;
|
||||
a b
|
||||
1 apple
|
||||
drop table t1;
|
||||
create table t11 (a int NOT NULL, b int, primary key (a));
|
||||
create table t12 (a int NOT NULL, b int, primary key (a));
|
||||
create table t2 (a int NOT NULL, b int, primary key (a));
|
||||
insert into t11 values (0, 10),(1, 11),(2, 12);
|
||||
insert into t12 values (33, 10),(0, 11),(2, 12);
|
||||
insert into t2 values (1, 21),(2, 12),(3, 23);
|
||||
select * from t11;
|
||||
a b
|
||||
0 10
|
||||
1 11
|
||||
2 12
|
||||
select * from t12;
|
||||
a b
|
||||
33 10
|
||||
0 11
|
||||
2 12
|
||||
select * from t2;
|
||||
a b
|
||||
1 21
|
||||
2 12
|
||||
3 23
|
||||
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
select * from t11;
|
||||
a b
|
||||
0 10
|
||||
1 11
|
||||
2 12
|
||||
select * from t12;
|
||||
a b
|
||||
33 10
|
||||
0 11
|
||||
2 12
|
||||
delete ignore t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
|
||||
Warnings:
|
||||
Error 1242 Subquery returns more than 1 row
|
||||
Error 1242 Subquery returns more than 1 row
|
||||
select * from t11;
|
||||
a b
|
||||
0 10
|
||||
1 11
|
||||
select * from t12;
|
||||
a b
|
||||
33 10
|
||||
0 11
|
||||
insert into t11 values (2, 12);
|
||||
delete from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
select * from t11;
|
||||
a b
|
||||
0 10
|
||||
1 11
|
||||
2 12
|
||||
delete ignore from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
|
||||
Warnings:
|
||||
Error 1242 Subquery returns more than 1 row
|
||||
Error 1242 Subquery returns more than 1 row
|
||||
select * from t11;
|
||||
a b
|
||||
0 10
|
||||
1 11
|
||||
drop table t11, t12, t2;
|
||||
create table t1 (a int, b int, unique key (a), key (b));
|
||||
insert into t1 values (3, 3), (7, 7);
|
||||
delete t1 from t1 where a = 3;
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
select * from t1;
|
||||
a b
|
||||
7 7
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( a int PRIMARY KEY );
|
||||
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a;
|
||||
INSERT INTO t1 VALUES (0),(1),(2);
|
||||
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a LIMIT 1;
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
0
|
||||
2
|
||||
DROP TABLE t1;
|
||||
create table t1 (a int);
|
||||
delete `4.t1` from t1 as `4.t1` where `4.t1`.a = 5;
|
||||
delete FROM `4.t1` USING t1 as `4.t1` where `4.t1`.a = 5;
|
||||
drop table t1;
|
||||
create table t1(f1 int primary key);
|
||||
insert into t1 values (4),(3),(1),(2);
|
||||
delete from t1 where (@a:= f1) order by f1 limit 1;
|
||||
select @a;
|
||||
@a
|
||||
1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
`date` date ,
|
||||
`time` time ,
|
||||
`seq` int(10) unsigned NOT NULL auto_increment,
|
||||
PRIMARY KEY (`seq`),
|
||||
KEY `seq` (`seq`),
|
||||
KEY `time` (`time`),
|
||||
KEY `date` (`date`)
|
||||
);
|
||||
DELETE FROM t1 ORDER BY date ASC, time ASC LIMIT 1;
|
||||
drop table t1;
|
||||
End of 4.1 tests
|
||||
CREATE TABLE t1 (a int not null,b int not null);
|
||||
CREATE TABLE t2 (a int not null, b int not null, primary key (a,b));
|
||||
CREATE TABLE t3 (a int not null, b int not null, primary key (a,b));
|
||||
insert into t1 values (1,1),(2,1),(1,3);
|
||||
insert into t2 values (1,1),(2,2),(3,3);
|
||||
insert into t3 values (1,1),(2,1),(1,3);
|
||||
select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
|
||||
a b a b a b
|
||||
1 1 1 1 1 1
|
||||
2 1 2 2 2 1
|
||||
1 3 1 1 1 3
|
||||
explain select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a 1 Using index
|
||||
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 8 test.t2.b,test.t1.b 1 Using index
|
||||
delete t2.*,t3.* from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
|
||||
select * from t3;
|
||||
a b
|
||||
drop table t1,t2,t3;
|
||||
create table t1(a date not null);
|
||||
insert into t1 values (0);
|
||||
select * from t1 where a is null;
|
||||
a
|
||||
0000-00-00
|
||||
delete from t1 where a is null;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
DELETE FROM t1 ORDER BY x;
|
||||
ERROR 42S22: Unknown column 'x' in 'order clause'
|
||||
DELETE FROM t1 ORDER BY t2.x;
|
||||
ERROR 42S22: Unknown column 't2.x' in 'order clause'
|
||||
DELETE FROM t1 ORDER BY (SELECT x);
|
||||
ERROR 42S22: Unknown column 'x' in 'field list'
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
a INT
|
||||
);
|
||||
CREATE TABLE t2 (
|
||||
a INT
|
||||
);
|
||||
CREATE DATABASE db1;
|
||||
CREATE TABLE db1.t1 (
|
||||
a INT
|
||||
);
|
||||
INSERT INTO db1.t1 (a) SELECT * FROM t1;
|
||||
CREATE DATABASE db2;
|
||||
CREATE TABLE db2.t1 (
|
||||
a INT
|
||||
);
|
||||
INSERT INTO db2.t1 (a) SELECT * FROM t2;
|
||||
DELETE FROM t1 alias USING t1, t2 alias WHERE t1.a = alias.a;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'alias USING t1, t2 alias WHERE t1.a = alias.a' at line 1
|
||||
DELETE FROM alias USING t1, t2 alias WHERE t1.a = alias.a;
|
||||
DELETE FROM t1, alias USING t1, t2 alias WHERE t1.a = alias.a;
|
||||
DELETE FROM t1, t2 USING t1, t2 alias WHERE t1.a = alias.a;
|
||||
ERROR 42S02: Unknown table 't2' in MULTI DELETE
|
||||
DELETE FROM db1.t1 alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a' at line 1
|
||||
DELETE FROM alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
|
||||
ERROR 42S02: Unknown table 'alias' in MULTI DELETE
|
||||
DELETE FROM db2.alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
|
||||
DELETE FROM t1 USING t1 WHERE a = 1;
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
DELETE FROM t1 alias USING t1 alias WHERE a = 2;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'alias USING t1 alias WHERE a = 2' at line 1
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
DROP TABLE t1, t2;
|
||||
DROP DATABASE db1;
|
||||
DROP DATABASE db2;
|
||||
CREATE FUNCTION f1() RETURNS INT RETURN 1;
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (0);
|
||||
DELETE FROM t1 ORDER BY (f1(10)) LIMIT 1;
|
||||
ERROR 42000: Incorrect number of arguments for FUNCTION test.f1; expected 0, got 1
|
||||
DROP TABLE t1;
|
||||
DROP FUNCTION f1;
|
||||
#
|
||||
# Bug #49552 : sql_buffer_result cause crash + not found records
|
||||
# in multitable delete/subquery
|
||||
#
|
||||
CREATE TABLE t1(a INT);
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
SET SESSION SQL_BUFFER_RESULT=1;
|
||||
DELETE t1 FROM (SELECT SUM(a) a FROM t1) x,t1;
|
||||
SET SESSION SQL_BUFFER_RESULT=DEFAULT;
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
#
|
||||
# Bug#46958: Assertion in Diagnostics_area::set_ok_status, trigger,
|
||||
# merge table
|
||||
#
|
||||
CREATE TABLE t1 ( a INT );
|
||||
CREATE TABLE t2 ( a INT );
|
||||
CREATE TABLE t3 ( a INT );
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
INSERT INTO t2 VALUES (1), (2);
|
||||
INSERT INTO t3 VALUES (1), (2);
|
||||
CREATE TRIGGER tr1 BEFORE DELETE ON t2
|
||||
FOR EACH ROW INSERT INTO no_such_table VALUES (1);
|
||||
DELETE t1, t2, t3 FROM t1, t2, t3;
|
||||
ERROR 42S02: Table 'test.no_such_table' doesn't exist
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
SELECT * FROM t2;
|
||||
a
|
||||
1
|
||||
2
|
||||
SELECT * FROM t3;
|
||||
a
|
||||
1
|
||||
2
|
||||
DROP TABLE t1, t2, t3;
|
||||
CREATE TABLE t1 ( a INT );
|
||||
CREATE TABLE t2 ( a INT );
|
||||
CREATE TABLE t3 ( a INT );
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
INSERT INTO t2 VALUES (1), (2);
|
||||
INSERT INTO t3 VALUES (1), (2);
|
||||
CREATE TRIGGER tr1 AFTER DELETE ON t2
|
||||
FOR EACH ROW INSERT INTO no_such_table VALUES (1);
|
||||
DELETE t1, t2, t3 FROM t1, t2, t3;
|
||||
ERROR 42S02: Table 'test.no_such_table' doesn't exist
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
SELECT * FROM t2;
|
||||
a
|
||||
2
|
||||
SELECT * FROM t3;
|
||||
a
|
||||
1
|
||||
2
|
||||
DROP TABLE t1, t2, t3;
|
||||
#
|
||||
# Bug #46425 crash in Diagnostics_area::set_ok_status,
|
||||
# empty statement, DELETE IGNORE
|
||||
#
|
||||
CREATE table t1 (i INTEGER);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
CREATE TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO t1 SELECT * FROM t1 AS A;
|
||||
END |
|
||||
DELETE IGNORE FROM t1;
|
||||
ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #53450: Crash/assertion
|
||||
# "virtual int ha_myisam::index_first(uchar*)") at assert.c:81
|
||||
#
|
||||
CREATE TABLE t1 (a INT, b INT, c INT,
|
||||
INDEX(a), INDEX(b), INDEX(c));
|
||||
INSERT INTO t1 VALUES (1,2,3), (4,5,6), (7,8,9);
|
||||
DELETE FROM t1 WHERE a = 10 OR b = 20 ORDER BY c LIMIT 1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #53034: Multiple-table DELETE statements not accepting
|
||||
# "Access compatibility" syntax
|
||||
#
|
||||
CREATE TABLE t1 (id INT);
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
CREATE TABLE t3 LIKE t1;
|
||||
DELETE FROM t1.*, test.t2.*, a.* USING t1, t2, t3 AS a;
|
||||
DROP TABLE t1, t2, t3;
|
||||
End of 5.1 tests
|
||||
414
build/lib/mysql/mysql-test/r/derived.result
Normal file
414
build/lib/mysql/mysql-test/r/derived.result
Normal file
@@ -0,0 +1,414 @@
|
||||
drop table if exists t1,t2,t3;
|
||||
select * from (select 2 from DUAL) b;
|
||||
2
|
||||
2
|
||||
SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b;
|
||||
ERROR 42S22: Unknown column 'a' in 'field list'
|
||||
SELECT 1 as a FROM (SELECT a UNION SELECT 1) b;
|
||||
ERROR 42S22: Unknown column 'a' in 'field list'
|
||||
CREATE TABLE t1 (a int not null, b char (10) not null);
|
||||
insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
|
||||
CREATE TABLE t2 (a int not null, b char (10) not null);
|
||||
insert into t2 values (3,'c'),(4,'d'),(5,'f'),(6,'e');
|
||||
select t1.a,t3.y from t1,(select a as y from t2 where b='c') as t3 where t1.a = t3.y;
|
||||
a y
|
||||
3 3
|
||||
3 3
|
||||
select t1.a,t3.a from t1,(select * from t2 where b='c') as t3 where t1.a = t3.a;
|
||||
a a
|
||||
3 3
|
||||
3 3
|
||||
CREATE TABLE t3 (a int not null, b char (10) not null);
|
||||
insert into t3 values (3,'f'),(4,'y'),(5,'z'),(6,'c');
|
||||
select t1.a,t4.y from t1,(select t2.a as y from t2,(select t3.b from t3 where t3.a>3) as t5 where t2.b=t5.b) as t4 where t1.a = t4.y;
|
||||
a y
|
||||
3 3
|
||||
3 3
|
||||
SELECT a FROM (SELECT 1 FROM (SELECT 1) a HAVING a=1) b;
|
||||
ERROR 42S22: Unknown column 'a' in 'having clause'
|
||||
SELECT a,b as a FROM (SELECT '1' as a,'2' as b) b HAVING a=1;
|
||||
ERROR 23000: Column 'a' in having clause is ambiguous
|
||||
SELECT a,2 as a FROM (SELECT '1' as a) b HAVING a=2;
|
||||
a a
|
||||
1 2
|
||||
SELECT a,2 as a FROM (SELECT '1' as a) b HAVING a=1;
|
||||
a a
|
||||
SELECT 1 FROM (SELECT 1) a WHERE a=2;
|
||||
ERROR 42S22: Unknown column 'a' in 'where clause'
|
||||
SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) as a;
|
||||
ERROR 42S22: Unknown column 'a' in 'having clause'
|
||||
select * from t1 as x1, (select * from t1) as x2;
|
||||
a b a b
|
||||
1 a 1 a
|
||||
2 b 1 a
|
||||
3 c 1 a
|
||||
3 c 1 a
|
||||
1 a 2 b
|
||||
2 b 2 b
|
||||
3 c 2 b
|
||||
3 c 2 b
|
||||
1 a 3 c
|
||||
2 b 3 c
|
||||
3 c 3 c
|
||||
3 c 3 c
|
||||
1 a 3 c
|
||||
2 b 3 c
|
||||
3 c 3 c
|
||||
3 c 3 c
|
||||
explain select * from t1 as x1, (select * from t1) as x2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY x1 ALL NULL NULL NULL NULL 4
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 Using join buffer
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 4
|
||||
drop table if exists t2,t3;
|
||||
select * from (select 1) as a;
|
||||
1
|
||||
1
|
||||
select a from (select 1 as a) as b;
|
||||
a
|
||||
1
|
||||
select 1 from (select 1) as a;
|
||||
1
|
||||
1
|
||||
select * from (select * from t1 union select * from t1) a;
|
||||
a b
|
||||
1 a
|
||||
2 b
|
||||
3 c
|
||||
select * from (select * from t1 union all select * from t1) a;
|
||||
a b
|
||||
1 a
|
||||
2 b
|
||||
3 c
|
||||
3 c
|
||||
1 a
|
||||
2 b
|
||||
3 c
|
||||
3 c
|
||||
select * from (select * from t1 union all select * from t1 limit 2) a;
|
||||
a b
|
||||
1 a
|
||||
2 b
|
||||
explain select * from (select * from t1 union select * from t1) a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 4
|
||||
3 UNION t1 ALL NULL NULL NULL NULL 4
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
explain select * from (select * from t1 union all select * from t1) a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 8
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 4
|
||||
3 UNION t1 ALL NULL NULL NULL NULL 4
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
CREATE TABLE t2 (a int not null);
|
||||
insert into t2 values(1);
|
||||
select * from (select * from t1 where t1.a=(select a from t2 where t2.a=t1.a)) a;
|
||||
a b
|
||||
1 a
|
||||
select * from (select * from t1 where t1.a=(select t2.a from t2 where t2.a=t1.a) union select t1.a, t1.b from t1) a;
|
||||
a b
|
||||
1 a
|
||||
2 b
|
||||
3 c
|
||||
explain select * from (select t1.*, t2.a as t2a from t1,t2 where t1.a=t2.a) t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
||||
2 DERIVED t2 system NULL NULL NULL NULL 1
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 4 Using where
|
||||
drop table t1, t2;
|
||||
create table t1(a int not null, t char(8), index(a));
|
||||
SELECT * FROM (SELECT * FROM t1) as b ORDER BY a ASC LIMIT 0,20;
|
||||
a t
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
4 4
|
||||
5 5
|
||||
6 6
|
||||
7 7
|
||||
8 8
|
||||
9 9
|
||||
10 10
|
||||
11 11
|
||||
12 12
|
||||
13 13
|
||||
14 14
|
||||
15 15
|
||||
16 16
|
||||
17 17
|
||||
18 18
|
||||
19 19
|
||||
20 20
|
||||
explain select count(*) from t1 as tt1, (select * from t1) as tt2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 10000
|
||||
drop table t1;
|
||||
SELECT * FROM (SELECT (SELECT * FROM (SELECT 1 as a) as a )) as b;
|
||||
(SELECT * FROM (SELECT 1 as a) as a )
|
||||
1
|
||||
select * from (select 1 as a) b left join (select 2 as a) c using(a);
|
||||
a
|
||||
1
|
||||
SELECT * FROM (SELECT 1 UNION SELECT a) b;
|
||||
ERROR 42S22: Unknown column 'a' in 'field list'
|
||||
SELECT 1 as a FROM (SELECT a UNION SELECT 1) b;
|
||||
ERROR 42S22: Unknown column 'a' in 'field list'
|
||||
SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b;
|
||||
ERROR 42S22: Unknown column 'a' in 'field list'
|
||||
select 1 from (select 2) a order by 0;
|
||||
ERROR 42S22: Unknown column '0' in 'order clause'
|
||||
create table t1 (id int);
|
||||
insert into t1 values (1),(2),(3);
|
||||
describe select * from (select * from t1 group by id) bar;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
|
||||
drop table t1;
|
||||
create table t1 (mat_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, matintnum CHAR(6) NOT NULL, test MEDIUMINT UNSIGNED NULL);
|
||||
create table t2 (mat_id MEDIUMINT UNSIGNED NOT NULL, pla_id MEDIUMINT UNSIGNED NOT NULL);
|
||||
insert into t1 values (NULL, 'a', 1), (NULL, 'b', 2), (NULL, 'c', 3), (NULL, 'd', 4), (NULL, 'e', 5), (NULL, 'f', 6), (NULL, 'g', 7), (NULL, 'h', 8), (NULL, 'i', 9);
|
||||
insert into t2 values (1, 100), (1, 101), (1, 102), (2, 100), (2, 103), (2, 104), (3, 101), (3, 102), (3, 105);
|
||||
SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum;
|
||||
pla_id mat_id
|
||||
100 1
|
||||
101 1
|
||||
102 1
|
||||
103 2
|
||||
104 2
|
||||
105 3
|
||||
SELECT STRAIGHT_JOIN d.pla_id, m2.test FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum;
|
||||
pla_id test
|
||||
100 1
|
||||
101 1
|
||||
102 1
|
||||
103 2
|
||||
104 2
|
||||
105 3
|
||||
explain SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY m2 ALL NULL NULL NULL NULL 9
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6 Using where; Using join buffer
|
||||
2 DERIVED mp ALL NULL NULL NULL NULL 9 Using temporary; Using filesort
|
||||
2 DERIVED m1 eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1
|
||||
explain SELECT STRAIGHT_JOIN d.pla_id, m2.test FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY m2 ALL NULL NULL NULL NULL 9
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 6 Using where; Using join buffer
|
||||
2 DERIVED mp ALL NULL NULL NULL NULL 9 Using temporary; Using filesort
|
||||
2 DERIVED m1 eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1
|
||||
drop table t1,t2;
|
||||
SELECT a.x FROM (SELECT 1 AS x) AS a HAVING a.x = 1;
|
||||
x
|
||||
1
|
||||
create user mysqltest_1;
|
||||
create table t1 select 1 as a;
|
||||
select 2 as a from (select * from t1) b;
|
||||
ERROR 3D000: No database selected
|
||||
use test;
|
||||
select 2 as a from (select * from t1) b;
|
||||
a
|
||||
2
|
||||
drop table t1;
|
||||
select mail_id, if(folder.f_description!='', folder.f_description, folder.f_name) as folder_name, date, address_id, phrase, address, subject from folder, (select mail.mail_id as mail_id, date_format(mail.h_date, '%b %e, %Y %h:%i') as date, mail.folder_id, sender.address_id as address_id, sender.phrase as phrase, sender.address as address, mail.h_subject as subject from mail left join mxa as mxa_sender on mail.mail_id=mxa_sender.mail_id and mxa_sender.type='from' left join address as sender on mxa_sender.address_id=sender.address_id mxa as mxa_recipient, address as recipient, where 1 and mail.mail_id=mxa_recipient.mail_id and mxa_recipient.address_id=recipient.address_id and mxa_recipient.type='to' and match(sender.phrase, sender.address, sender.comment) against ('jeremy' in boolean mode) and match(recipient.phrase, recipient.address, recipient.comment) against ('monty' in boolean mode) order by mail.h_date desc limit 0, 25 ) as query where query.folder_id=folder.folder_id;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mxa as mxa_recipient, address as recipient, where 1 and mail.mail_id=mxa_r' at line 1
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(2),(3);
|
||||
update (select * from t1) as t1 set a = 5;
|
||||
ERROR HY000: The target table t1 of the UPDATE is not updatable
|
||||
delete from (select * from t1);
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(select * from t1)' at line 1
|
||||
insert into (select * from t1) values (5);
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(select * from t1) values (5)' at line 1
|
||||
drop table t1;
|
||||
create table t1 (E1 INTEGER UNSIGNED NOT NULL, E2 INTEGER UNSIGNED NOT NULL, E3 INTEGER UNSIGNED NOT NULL, PRIMARY KEY(E1)
|
||||
);
|
||||
insert into t1 VALUES(1,1,1), (2,2,1);
|
||||
select count(*) from t1 INNER JOIN (SELECT A.E1, A.E2, A.E3 FROM t1 AS A WHERE A.E3 = (SELECT MAX(B.E3) FROM t1 AS B WHERE A.E2 = B.E2)) AS THEMAX ON t1.E1 = THEMAX.E2 AND t1.E1 = t1.E2;
|
||||
count(*)
|
||||
2
|
||||
explain select count(*) from t1 INNER JOIN (SELECT A.E1, A.E2, A.E3 FROM t1 AS A WHERE A.E3 = (SELECT MAX(B.E3) FROM t1 AS B WHERE A.E2 = B.E2)) AS THEMAX ON t1.E1 = THEMAX.E2 AND t1.E1 = t1.E2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
|
||||
1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 THEMAX.E2 1 Using where
|
||||
2 DERIVED A ALL NULL NULL NULL NULL 2 Using where
|
||||
3 DEPENDENT SUBQUERY B ALL NULL NULL NULL NULL 2 Using where
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(2);
|
||||
select * from ( select * from t1 union select * from t1) a,(select * from t1 union select * from t1) b;
|
||||
a a
|
||||
1 1
|
||||
2 1
|
||||
1 2
|
||||
2 2
|
||||
explain select * from ( select * from t1 union select * from t1) a,(select * from t1 union select * from t1) b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
|
||||
1 PRIMARY <derived4> ALL NULL NULL NULL NULL 2 Using join buffer
|
||||
4 DERIVED t1 ALL NULL NULL NULL NULL 2
|
||||
5 UNION t1 ALL NULL NULL NULL NULL 2
|
||||
NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 2
|
||||
3 UNION t1 ALL NULL NULL NULL NULL 2
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
drop table t1;
|
||||
CREATE TABLE `t1` (
|
||||
`N` int(11) unsigned NOT NULL default '0',
|
||||
`M` tinyint(1) default '0'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
INSERT INTO `t1` (N, M) VALUES (1, 0),(1, 0),(1, 0),(2, 0),(2, 0),(3, 0);
|
||||
UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
|
||||
select * from t1;
|
||||
N M
|
||||
1 2
|
||||
1 2
|
||||
1 2
|
||||
2 2
|
||||
2 2
|
||||
3 0
|
||||
UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2, P2.N = 2;
|
||||
ERROR HY000: The target table P2 of the UPDATE is not updatable
|
||||
UPDATE `t1` AS P1 INNER JOIN (SELECT aaaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
|
||||
ERROR 42S22: Unknown column 'aaaa' in 'field list'
|
||||
delete P1.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
|
||||
select * from t1;
|
||||
N M
|
||||
3 0
|
||||
delete P1.*,p2.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS p2 ON P1.N = p2.N;
|
||||
ERROR 42S02: Unknown table 'p2' in MULTI DELETE
|
||||
delete P1.* from `t1` AS P1 INNER JOIN (SELECT aaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
|
||||
ERROR 42S22: Unknown column 'aaa' in 'field list'
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
OBJECTID int(11) NOT NULL default '0',
|
||||
SORTORDER int(11) NOT NULL auto_increment,
|
||||
KEY t1_SortIndex (SORTORDER),
|
||||
KEY t1_IdIndex (OBJECTID)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
CREATE TABLE t2 (
|
||||
ID int(11) default NULL,
|
||||
PARID int(11) default NULL,
|
||||
UNIQUE KEY t2_ID_IDX (ID),
|
||||
KEY t2_PARID_IDX (PARID)
|
||||
) engine=MyISAM DEFAULT CHARSET=latin1;
|
||||
INSERT INTO t2 VALUES (1000,0),(1001,0),(1002,0),(1003,0),(1008,1),(1009,1),(1010,1),(1011,1),(1016,2);
|
||||
CREATE TABLE t3 (
|
||||
ID int(11) default NULL,
|
||||
DATA decimal(10,2) default NULL,
|
||||
UNIQUE KEY t3_ID_IDX (ID)
|
||||
) engine=MyISAM DEFAULT CHARSET=latin1;
|
||||
INSERT INTO t3 VALUES (1000,0.00),(1001,0.25),(1002,0.50),(1003,0.75),(1008,1.00),(1009,1.25),(1010,1.50),(1011,1.75);
|
||||
select 497, TMP.ID, NULL from (select 497 as ID, MAX(t3.DATA) as DATA from t1 join t2 on (t1.ObjectID = t2.ID) join t3 on (t1.ObjectID = t3.ID) group by t2.ParID order by DATA DESC) as TMP;
|
||||
497 ID NULL
|
||||
drop table t1, t2, t3;
|
||||
CREATE TABLE t1 (name char(1) default NULL, val int(5) default NULL);
|
||||
INSERT INTO t1 VALUES ('a',1), ('a',2), ('a',2), ('a',2), ('a',3), ('a',6), ('a',7), ('a',11), ('a',11), ('a',12), ('a',13), ('a',13), ('a',20), ('b',2), ('b',3), ('b',4), ('b',5);
|
||||
SELECT s.name, AVG(s.val) AS median FROM (SELECT x.name, x.val FROM t1 x, t1 y WHERE x.name=y.name GROUP BY x.name, x.val HAVING SUM(y.val <= x.val) >= COUNT(*)/2 AND SUM(y.val >= x.val) >= COUNT(*)/2) AS s GROUP BY s.name;
|
||||
name median
|
||||
a 7.0000
|
||||
b 3.5000
|
||||
explain SELECT s.name, AVG(s.val) AS median FROM (SELECT x.name, x.val FROM t1 x, t1 y WHERE x.name=y.name GROUP BY x.name, x.val HAVING SUM(y.val <= x.val) >= COUNT(*)/2 AND SUM(y.val >= x.val) >= COUNT(*)/2) AS s GROUP BY s.name;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
|
||||
2 DERIVED x ALL NULL NULL NULL NULL 17 Using temporary; Using filesort
|
||||
2 DERIVED y ALL NULL NULL NULL NULL 17 Using where; Using join buffer
|
||||
drop table t1;
|
||||
create table t2 (a int, b int, primary key (a));
|
||||
insert into t2 values (1,7),(2,7);
|
||||
explain select a from t2 where a>1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 index PRIMARY PRIMARY 4 NULL 2 Using where; Using index
|
||||
explain select a from (select a from t2 where a>1) tt;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
|
||||
2 DERIVED t2 index PRIMARY PRIMARY 4 NULL 2 Using where; Using index
|
||||
drop table t2;
|
||||
CREATE TABLE `t1` ( `itemid` int(11) NOT NULL default '0', `grpid` varchar(15) NOT NULL default '', `vendor` int(11) NOT NULL default '0', `date_` date NOT NULL default '0000-00-00', `price` decimal(12,2) NOT NULL default '0.00', PRIMARY KEY (`itemid`,`grpid`,`vendor`,`date_`), KEY `itemid` (`itemid`,`vendor`), KEY `itemid_2` (`itemid`,`date_`));
|
||||
insert into t1 values (128, 'rozn', 2, curdate(), 10),
|
||||
(128, 'rozn', 1, curdate(), 10);
|
||||
SELECT MIN(price) min, MAX(price) max, AVG(price) avg FROM (SELECT SUBSTRING( MAX(concat(date_,";",price)), 12) price FROM t1 WHERE itemid=128 AND grpid='rozn' GROUP BY itemid, grpid, vendor) lastprices;
|
||||
min max avg
|
||||
10.00 10.00 10
|
||||
DROP TABLE t1;
|
||||
create table t1 (a integer, b integer);
|
||||
insert into t1 values (1,4), (2,2),(2,2), (4,1),(4,1),(4,1),(4,1);
|
||||
select distinct sum(b) from t1 group by a;
|
||||
sum(b)
|
||||
4
|
||||
select distinct sum(b) from (select a,b from t1) y group by a;
|
||||
sum(b)
|
||||
4
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (a char(10), b char(10));
|
||||
INSERT INTO t1 VALUES ('root','localhost'), ('root','%');
|
||||
SELECT * FROM (SELECT (SELECT a.a FROM t1 AS a WHERE a.a = b.a) FROM t1 AS b) AS c;
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
DROP TABLE t1;
|
||||
create table t1(a int);
|
||||
create table t2(a int);
|
||||
create table t3(a int);
|
||||
insert into t1 values(1),(1);
|
||||
insert into t2 values(2),(2);
|
||||
insert into t3 values(3),(3);
|
||||
select * from t1 union distinct select * from t2 union all select * from t3;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
3
|
||||
select * from (select * from t1 union distinct select * from t2 union all select * from t3) X;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
3
|
||||
drop table t1, t2, t3;
|
||||
create table t1 (a int);
|
||||
create table t2 (a int);
|
||||
select * from (select * from t1,t2) foo;
|
||||
ERROR 42S21: Duplicate column name 'a'
|
||||
drop table t1,t2;
|
||||
create table t1 (ID int unsigned not null auto_increment,
|
||||
DATA varchar(5) not null, primary key (ID));
|
||||
create table t2 (ID int unsigned not null auto_increment,
|
||||
DATA varchar(5) not null, FID int unsigned not null,
|
||||
primary key (ID));
|
||||
select A.* from (t1 inner join (select * from t2) as A on t1.ID = A.FID);
|
||||
ID DATA FID
|
||||
select t2.* from ((select * from t1) as A inner join t2 on A.ID = t2.FID);
|
||||
ID DATA FID
|
||||
select t2.* from (select * from t1) as A inner join t2 on A.ID = t2.FID;
|
||||
ID DATA FID
|
||||
drop table t1, t2;
|
||||
drop user mysqltest_1;
|
||||
# End of 4.1 tests
|
||||
SELECT 0 FROM
|
||||
(SELECT 0) t01, (SELECT 0) t02, (SELECT 0) t03, (SELECT 0) t04, (SELECT 0) t05,
|
||||
(SELECT 0) t06, (SELECT 0) t07, (SELECT 0) t08, (SELECT 0) t09, (SELECT 0) t10,
|
||||
(SELECT 0) t11, (SELECT 0) t12, (SELECT 0) t13, (SELECT 0) t14, (SELECT 0) t15,
|
||||
(SELECT 0) t16, (SELECT 0) t17, (SELECT 0) t18, (SELECT 0) t19, (SELECT 0) t20,
|
||||
(SELECT 0) t21, (SELECT 0) t22, (SELECT 0) t23, (SELECT 0) t24, (SELECT 0) t25,
|
||||
(SELECT 0) t26, (SELECT 0) t27, (SELECT 0) t28, (SELECT 0) t29, (SELECT 0) t30,
|
||||
(SELECT 0) t31, (SELECT 0) t32, (SELECT 0) t33, (SELECT 0) t34, (SELECT 0) t35,
|
||||
(SELECT 0) t36, (SELECT 0) t37, (SELECT 0) t38, (SELECT 0) t39, (SELECT 0) t40,
|
||||
(SELECT 0) t41, (SELECT 0) t42, (SELECT 0) t43, (SELECT 0) t44, (SELECT 0) t45,
|
||||
(SELECT 0) t46, (SELECT 0) t47, (SELECT 0) t48, (SELECT 0) t49, (SELECT 0) t50,
|
||||
(SELECT 0) t51, (SELECT 0) t52, (SELECT 0) t53, (SELECT 0) t54, (SELECT 0) t55,
|
||||
(SELECT 0) t56, (SELECT 0) t57, (SELECT 0) t58, (SELECT 0) t59, (SELECT 0) t60,
|
||||
(SELECT 0) t61;
|
||||
0
|
||||
0
|
||||
#
|
||||
# A nested materialized derived table is used before being populated.
|
||||
# (addon for bug#19077)
|
||||
#
|
||||
CREATE TABLE t1 (i INT, j BIGINT);
|
||||
INSERT INTO t1 VALUES (1, 2), (2, 2), (3, 2);
|
||||
SELECT * FROM (SELECT MIN(i) FROM t1
|
||||
WHERE j = SUBSTRING('12', (SELECT * FROM (SELECT MIN(j) FROM t1) t2))) t3;
|
||||
MIN(i)
|
||||
1
|
||||
DROP TABLE t1;
|
||||
# End of 5.0 tests
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user