mirror of
https://github.com/MariaDB/server.git
synced 2025-09-05 08:04:25 +03:00
Merge mysql.com:/usr/local/bk/mysql-5.0
into mysql.com:/home/pem/work/mysql-5.0
This commit is contained in:
32
mysql-test/r/analyze.result
Normal file
32
mysql-test/r/analyze.result
Normal file
@@ -0,0 +1,32 @@
|
||||
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;
|
@@ -355,3 +355,42 @@ CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
DROP TABLE IF EXISTS t1;
|
||||
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 2
|
||||
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;
|
||||
|
@@ -434,7 +434,7 @@ d date YES NULL
|
||||
e varchar(1) NO
|
||||
f datetime YES NULL
|
||||
g time YES NULL
|
||||
h varbinary(23) NO
|
||||
h longblob NO
|
||||
dd time YES NULL
|
||||
select * from t2;
|
||||
a b c d e f g h dd
|
||||
@@ -513,9 +513,9 @@ drop database mysqltest;
|
||||
select database();
|
||||
database()
|
||||
NULL
|
||||
select database();
|
||||
database()
|
||||
NULL
|
||||
select database(), user();
|
||||
database() user()
|
||||
NULL mysqltest_1@localhost
|
||||
use test;
|
||||
create table t1 (a int, index `primary` (a));
|
||||
ERROR 42000: Incorrect index name 'primary'
|
||||
@@ -579,7 +579,6 @@ select * from t2;
|
||||
b
|
||||
1
|
||||
drop table t1,t2;
|
||||
use test;
|
||||
create table t1 (a int);
|
||||
create table t1 select * from t1;
|
||||
ERROR HY000: You can't specify target table 't1' for update in FROM clause
|
||||
@@ -597,3 +596,9 @@ ERROR 42000: Incorrect database name 'xyz'
|
||||
create table t1(t1.name int);
|
||||
create table t2(test.t2.name int);
|
||||
drop table t1,t2;
|
||||
create database mysqltest;
|
||||
use mysqltest;
|
||||
drop database mysqltest;
|
||||
create table test.t1 like x;
|
||||
ERROR 42000: Incorrect database name 'NULL'
|
||||
drop table if exists test.t1;
|
||||
|
@@ -7,3 +7,15 @@ 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;
|
||||
|
@@ -2396,3 +2396,27 @@ utf8_unicode_ci 6109
|
||||
utf8_unicode_ci 61
|
||||
utf8_unicode_ci 6120
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (id int, a varchar(30) character set utf8);
|
||||
INSERT INTO t1 VALUES (1, _ucs2 0x01310069), (2, _ucs2 0x01310131);
|
||||
INSERT INTO t1 VALUES (3, _ucs2 0x00690069), (4, _ucs2 0x01300049);
|
||||
INSERT INTO t1 VALUES (5, _ucs2 0x01300130), (6, _ucs2 0x00490049);
|
||||
SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
|
||||
FROM t1 ORDER BY id;
|
||||
a la l ll u lu
|
||||
ıi 3 ıi 3 II 2
|
||||
ıı 4 ıı 4 II 2
|
||||
ii 2 ii 2 II 2
|
||||
İI 3 ii 2 İI 3
|
||||
İİ 4 ii 2 İİ 4
|
||||
II 2 ii 2 II 2
|
||||
ALTER TABLE t1 MODIFY a VARCHAR(30) character set utf8 collate utf8_turkish_ci;
|
||||
SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
|
||||
FROM t1 ORDER BY id;
|
||||
a la l ll u lu
|
||||
ıi 3 ıi 3 Iİ 3
|
||||
ıı 4 ıı 4 II 2
|
||||
ii 2 ii 2 İİ 4
|
||||
İI 3 iı 3 İI 3
|
||||
İİ 4 ii 2 İİ 4
|
||||
II 2 ıı 4 II 2
|
||||
DROP TABLE t1;
|
||||
|
@@ -891,3 +891,17 @@ string
|
||||
create table t1 (a varchar(255)) default character set utf8;
|
||||
insert into t1 values (1.0);
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
id int not null,
|
||||
city varchar(20) not null,
|
||||
key (city(7),id)
|
||||
) character set=utf8;
|
||||
insert into t1 values (1,'Durban North');
|
||||
insert into t1 values (2,'Durban');
|
||||
select * from t1 where city = 'Durban';
|
||||
id city
|
||||
2 Durban
|
||||
select * from t1 where city = 'Durban ';
|
||||
id city
|
||||
2 Durban
|
||||
drop table t1;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
drop table if exists t1,t11,t12,t2;
|
||||
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);
|
||||
@@ -172,3 +172,23 @@ a
|
||||
0
|
||||
2
|
||||
DROP TABLE t1;
|
||||
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 index PRIMARY PRIMARY 8 NULL 3 Using where; Using index
|
||||
1 SIMPLE t3 index PRIMARY PRIMARY 8 NULL 3 Using where; 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;
|
||||
|
@@ -464,3 +464,11 @@ SELECT DISTINCT html,SUM(rout)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin;
|
||||
html prod
|
||||
1 0.0000
|
||||
drop table t1;
|
||||
create table t1 (id int, dsc varchar(50));
|
||||
insert into t1 values (1, "line number one"), (2, "line number two"), (3, "line number three");
|
||||
select distinct id, IFNULL(dsc, '-') from t1;
|
||||
id IFNULL(dsc, '-')
|
||||
1 line number one
|
||||
2 line number two
|
||||
3 line number three
|
||||
drop table t1;
|
||||
|
@@ -343,18 +343,6 @@ GROUP_CONCAT(b ORDER BY b)
|
||||
First Row
|
||||
Second Row
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a),
|
||||
CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2);
|
||||
SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz;
|
||||
a_id b_list
|
||||
1 1,2,3
|
||||
2 4,5
|
||||
3 NULL
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (A_ID INT NOT NULL,A_DESC CHAR(3) NOT NULL,PRIMARY KEY (A_ID));
|
||||
INSERT INTO t1 VALUES (1,'ABC'), (2,'EFG'), (3,'HIJ');
|
||||
CREATE TABLE t2 (A_ID INT NOT NULL,B_DESC CHAR(3) NOT NULL,PRIMARY KEY (A_ID,B_DESC));
|
||||
@@ -462,6 +450,49 @@ SELECT GROUP_CONCAT(id) AS gc FROM t1 HAVING gc IS NULL;
|
||||
gc
|
||||
NULL
|
||||
DROP TABLE t1;
|
||||
create table t2 (a int, b int);
|
||||
insert into t2 values (1,1), (2,2);
|
||||
select b x, (select group_concat(x) from t2) from t2;
|
||||
x (select group_concat(x) from t2)
|
||||
1 1,1
|
||||
2 2,2
|
||||
drop table t2;
|
||||
create table t1 (d int not null auto_increment,primary key(d), a int, b int, c int);
|
||||
insert into t1(a,b) values (1,3), (1,4), (1,2), (2,7), (1,1), (1,2), (2,3), (2,3);
|
||||
select d,a,b from t1 order by a;
|
||||
d a b
|
||||
1 1 3
|
||||
2 1 4
|
||||
3 1 2
|
||||
5 1 1
|
||||
6 1 2
|
||||
4 2 7
|
||||
7 2 3
|
||||
8 2 3
|
||||
explain select a, group_concat(b) from t1 group by a with rollup;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using filesort
|
||||
select a, group_concat(b) from t1 group by a with rollup;
|
||||
a group_concat(b)
|
||||
1 3,4,2,1,2
|
||||
2 7,3,3
|
||||
NULL 3,4,2,1,2,7,3,3
|
||||
select a, group_concat(distinct b) from t1 group by a with rollup;
|
||||
a group_concat(distinct b)
|
||||
1 3,4,2,1
|
||||
2 7,3
|
||||
NULL 3,4,2,1,7
|
||||
select a, group_concat(b order by b) from t1 group by a with rollup;
|
||||
a group_concat(b order by b)
|
||||
1 1,2,2,3,4
|
||||
2 3,3,7
|
||||
NULL 1,2,2,3,3,3,4,7
|
||||
select a, group_concat(distinct b order by b) from t1 group by a with rollup;
|
||||
a group_concat(distinct b order by b)
|
||||
1 1,2,3,4
|
||||
2 3,7
|
||||
NULL 1,2,3,4,7
|
||||
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 group_concat(a) from t1 group by b;
|
||||
@@ -469,10 +500,3 @@ group_concat(a)
|
||||
ABW
|
||||
ABW
|
||||
drop table t1;
|
||||
create table r2 (a int, b int);
|
||||
insert into r2 values (1,1), (2,2);
|
||||
select b x, (select group_concat(x) from r2) from r2;
|
||||
x (select group_concat(x) from r2)
|
||||
1 1,1
|
||||
2 2,2
|
||||
drop table r2;
|
||||
|
@@ -130,3 +130,19 @@ Warnings:
|
||||
Note 1003 select degrees(pi()) AS `degrees(pi())`,radians(360) AS `radians(360)`
|
||||
select rand(rand);
|
||||
ERROR 42S22: Unknown column 'rand' in 'field list'
|
||||
create table t1 (col1 int, col2 decimal(60,30));
|
||||
insert into t1 values(1,1234567890.12345);
|
||||
select format(col2,7) from t1;
|
||||
format(col2,7)
|
||||
1,234,567,890.1234500
|
||||
select format(col2,8) from t1;
|
||||
format(col2,8)
|
||||
1,234,567,890.12345000
|
||||
insert into t1 values(7,1234567890123456.12345);
|
||||
select format(col2,6) from t1 where col1=7;
|
||||
format(col2,6)
|
||||
1,234,567,890,123,456.123450
|
||||
drop table t1;
|
||||
select round(150, 2);
|
||||
round(150, 2)
|
||||
150.00
|
||||
|
@@ -688,3 +688,21 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select timestamp_diff(WEEK,_latin1'2001-02-01',_latin1'2001-05-01') AS `a1`,timestamp_diff(SECOND_FRAC,_latin1'2001-02-01 12:59:59.120000',_latin1'2001-05-01 12:58:58.119999') AS `a2`
|
||||
select last_day('2005-00-00');
|
||||
last_day('2005-00-00')
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect datetime value: '2005-00-00'
|
||||
select last_day('2005-00-01');
|
||||
last_day('2005-00-01')
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect datetime value: '2005-00-01'
|
||||
select last_day('2005-01-00');
|
||||
last_day('2005-01-00')
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect datetime value: '2005-01-00'
|
||||
select time_format('100:00:00', '%H %k %h %I %l');
|
||||
time_format('100:00:00', '%H %k %h %I %l')
|
||||
100 100 04 04 4
|
||||
|
@@ -711,3 +711,14 @@ select min(b) from t1;
|
||||
min(b)
|
||||
3000000000
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (id int PRIMARY KEY, user_id int, hostname longtext);
|
||||
INSERT INTO t1 VALUES
|
||||
(1, 7, 'cache-dtc-af05.proxy.aol.com'),
|
||||
(2, 3, 'what.ever.com'),
|
||||
(3, 7, 'cache-dtc-af05.proxy.aol.com'),
|
||||
(4, 7, 'cache-dtc-af05.proxy.aol.com');
|
||||
SELECT hostname, COUNT(DISTINCT user_id) as no FROM t1
|
||||
WHERE hostname LIKE '%aol%'
|
||||
GROUP BY hostname;
|
||||
hostname no
|
||||
cache-dtc-af05.proxy.aol.com 1
|
||||
|
@@ -696,3 +696,8 @@ drop table t1;
|
||||
create table t1 (a int not null, b int not null auto_increment,
|
||||
primary key(a, b)) engine=heap;
|
||||
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
|
||||
create table t1 (c char(255), primary key(c(90)));
|
||||
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
|
||||
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
|
||||
ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' for key 1
|
||||
drop table t1;
|
||||
|
@@ -1,3 +1,4 @@
|
||||
DROP TABLE IF EXISTS t0,t1,t2;
|
||||
show variables where variable_name like "skip_show_database";
|
||||
Variable_name Value
|
||||
skip_show_database OFF
|
||||
@@ -752,3 +753,73 @@ SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHE
|
||||
table_schema count(*)
|
||||
information_schema 15
|
||||
mysql 17
|
||||
create database mysqltest;
|
||||
create table mysqltest.t1 (f1 int, f2 int);
|
||||
create table mysqltest.t2 (f1 int);
|
||||
grant select (f1) on mysqltest.t1 to user1@localhost;
|
||||
grant select on mysqltest.t2 to user2@localhost;
|
||||
grant select on mysqltest.* to user3@localhost;
|
||||
grant select on *.* to user4@localhost;
|
||||
select * from information_schema.column_privileges;
|
||||
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'user1'@'localhost' NULL mysqltest t1 f1 SELECT NO
|
||||
select * from information_schema.table_privileges;
|
||||
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||
select * from information_schema.schema_privileges;
|
||||
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
|
||||
select * from information_schema.user_privileges;
|
||||
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'user1'@'localhost' NULL USAGE NO
|
||||
show grants;
|
||||
Grants for user1@localhost
|
||||
GRANT USAGE ON *.* TO 'user1'@'localhost'
|
||||
GRANT SELECT (f1) ON `mysqltest`.`t1` TO 'user1'@'localhost'
|
||||
select * from information_schema.column_privileges;
|
||||
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||
select * from information_schema.table_privileges;
|
||||
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'user2'@'localhost' NULL mysqltest t2 SELECT NO
|
||||
select * from information_schema.schema_privileges;
|
||||
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
|
||||
select * from information_schema.user_privileges;
|
||||
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'user2'@'localhost' NULL USAGE NO
|
||||
show grants;
|
||||
Grants for user2@localhost
|
||||
GRANT USAGE ON *.* TO 'user2'@'localhost'
|
||||
GRANT SELECT ON `mysqltest`.`t2` TO 'user2'@'localhost'
|
||||
select * from information_schema.column_privileges;
|
||||
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||
select * from information_schema.table_privileges;
|
||||
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||
select * from information_schema.schema_privileges;
|
||||
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'user3'@'localhost' NULL mysqltest SELECT NO
|
||||
select * from information_schema.user_privileges;
|
||||
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'user3'@'localhost' NULL USAGE NO
|
||||
show grants;
|
||||
Grants for user3@localhost
|
||||
GRANT USAGE ON *.* TO 'user3'@'localhost'
|
||||
GRANT SELECT ON `mysqltest`.* TO 'user3'@'localhost'
|
||||
select * from information_schema.column_privileges where grantee like '%user%';
|
||||
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'user1'@'localhost' NULL mysqltest t1 f1 SELECT NO
|
||||
select * from information_schema.table_privileges where grantee like '%user%';
|
||||
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'user2'@'localhost' NULL mysqltest t2 SELECT NO
|
||||
select * from information_schema.schema_privileges where grantee like '%user%';
|
||||
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'user3'@'localhost' NULL mysqltest SELECT NO
|
||||
select * from information_schema.user_privileges where grantee like '%user%';
|
||||
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'user1'@'localhost' NULL USAGE NO
|
||||
'user2'@'localhost' NULL USAGE NO
|
||||
'user3'@'localhost' NULL USAGE NO
|
||||
'user4'@'localhost' NULL SELECT NO
|
||||
show grants;
|
||||
Grants for user4@localhost
|
||||
GRANT SELECT ON *.* TO 'user4'@'localhost'
|
||||
drop user user1@localhost, user2@localhost, user3@localhost, user4@localhost;
|
||||
use test;
|
||||
drop database mysqltest;
|
||||
|
@@ -931,7 +931,6 @@ a
|
||||
1
|
||||
2
|
||||
truncate table t1;
|
||||
truncate table t1;
|
||||
insert into t1 values(1),(2);
|
||||
delete from t1;
|
||||
select * from t1;
|
||||
@@ -1451,16 +1450,22 @@ test.t3 NULL
|
||||
test.t4 NULL
|
||||
Warnings:
|
||||
Error 1146 Table 'test.t4' doesn't exist
|
||||
checksum table t1, t2, t3;
|
||||
checksum table t1, t2, t3, t4;
|
||||
Table Checksum
|
||||
test.t1 2948697075
|
||||
test.t2 1157260244
|
||||
test.t3 1157260244
|
||||
checksum table t1, t2, t3 extended;
|
||||
test.t4 NULL
|
||||
Warnings:
|
||||
Error 1146 Table 'test.t4' doesn't exist
|
||||
checksum table t1, t2, t3, t4 extended;
|
||||
Table Checksum
|
||||
test.t1 3092701434
|
||||
test.t2 1157260244
|
||||
test.t3 1157260244
|
||||
test.t4 NULL
|
||||
Warnings:
|
||||
Error 1146 Table 'test.t4' doesn't exist
|
||||
drop table t1,t2,t3;
|
||||
create table t1 (id int, name char(10) not null, name2 char(10) not null) engine=innodb;
|
||||
insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');
|
||||
@@ -1633,14 +1638,14 @@ t2 CREATE TABLE `t2` (
|
||||
drop table t2, t1;
|
||||
show status like "binlog_cache_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_use 154
|
||||
Binlog_cache_use 153
|
||||
show status like "binlog_cache_disk_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_disk_use 0
|
||||
create table t1 (a int) engine=innodb;
|
||||
show status like "binlog_cache_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_use 155
|
||||
Binlog_cache_use 154
|
||||
show status like "binlog_cache_disk_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_disk_use 1
|
||||
@@ -1649,11 +1654,51 @@ delete from t1;
|
||||
commit;
|
||||
show status like "binlog_cache_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_use 156
|
||||
Binlog_cache_use 155
|
||||
show status like "binlog_cache_disk_use";
|
||||
Variable_name Value
|
||||
Binlog_cache_disk_use 1
|
||||
drop table t1;
|
||||
create table t1 (c char(10), index (c,c)) engine=innodb;
|
||||
ERROR 42S21: Duplicate column name 'c'
|
||||
create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb;
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb;
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
create table t1 (c1 char(10), c2 char(10)) engine=innodb;
|
||||
alter table t1 add key (c1,c1);
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
alter table t1 add key (c2,c1,c1);
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
alter table t1 add key (c1,c2,c1);
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
alter table t1 add key (c1,c1,c2);
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
drop table t1;
|
||||
create table t1(a int(1) , b int(1)) engine=innodb;
|
||||
insert into t1 values ('1111', '3333');
|
||||
select distinct concat(a, b) from t1;
|
||||
concat(a, b)
|
||||
11113333
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
|
||||
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
|
||||
ERROR HY000: The used table type doesn't support FULLTEXT indexes
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a),
|
||||
CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2);
|
||||
SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz;
|
||||
a_id b_list
|
||||
1 1,2,3
|
||||
2 4,5
|
||||
3 NULL
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
create table t1 (x bigint unsigned not null primary key) engine=innodb;
|
||||
insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);
|
||||
select * from t1;
|
||||
@@ -1688,24 +1733,6 @@ select count(*) from t1 where x = 18446744073709551601;
|
||||
count(*)
|
||||
1
|
||||
drop table t1;
|
||||
create table t1 (c char(10), index (c,c)) engine=innodb;
|
||||
ERROR 42S21: Duplicate column name 'c'
|
||||
create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb;
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb;
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
create table t1 (c1 char(10), c2 char(10)) engine=innodb;
|
||||
alter table t1 add key (c1,c1);
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
alter table t1 add key (c2,c1,c1);
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
alter table t1 add key (c1,c2,c1);
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
alter table t1 add key (c1,c1,c2);
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
drop table t1;
|
||||
show status like "Innodb_buffer_pool_pages_total";
|
||||
Variable_name Value
|
||||
Innodb_buffer_pool_pages_total 512
|
||||
@@ -1717,7 +1744,7 @@ Variable_name Value
|
||||
Innodb_rows_deleted 2070
|
||||
show status like "Innodb_rows_inserted";
|
||||
Variable_name Value
|
||||
Innodb_rows_inserted 31709
|
||||
Innodb_rows_inserted 31718
|
||||
show status like "Innodb_rows_updated";
|
||||
Variable_name Value
|
||||
Innodb_rows_updated 29530
|
||||
@@ -2391,13 +2418,51 @@ drop table t1;
|
||||
set storage_engine=MyISAM;
|
||||
create table t1 (v varchar(16384)) engine=innodb;
|
||||
drop table t1;
|
||||
create table t1(a int(1) , b int(1)) engine=innodb;
|
||||
insert into t1 values ('1111', '3333');
|
||||
select distinct concat(a, b) from t1;
|
||||
concat(a, b)
|
||||
11113333
|
||||
create table t1 (a char(1), b char(1), key(a, b)) engine=innodb;
|
||||
insert into t1 values ('8', '6'), ('4', '7');
|
||||
select min(a) from t1;
|
||||
min(a)
|
||||
4
|
||||
select min(b) from t1 where a='8';
|
||||
min(b)
|
||||
6
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`)) ENGINE=innodb;
|
||||
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)) engine=innodb;
|
||||
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 2
|
||||
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) engine=InnoDB;
|
||||
insert into t1 (val) values (1);
|
||||
update t1 set a=2 where a=1;
|
||||
insert into t1 (val) values (1);
|
||||
ERROR 23000: Duplicate entry '2' for key 1
|
||||
select * from t1;
|
||||
a val
|
||||
2 1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
|
||||
SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
|
||||
ERROR HY000: The used table type doesn't support FULLTEXT indexes
|
||||
DROP TABLE t1;
|
||||
|
@@ -132,6 +132,22 @@ a b
|
||||
handler t2 read last;
|
||||
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
|
||||
handler t2 close;
|
||||
handler t1 open;
|
||||
handler t1 read a next;
|
||||
a b
|
||||
14 aaa
|
||||
handler t1 read a next;
|
||||
a b
|
||||
15 bbb
|
||||
handler t1 close;
|
||||
handler t1 open;
|
||||
handler t1 read a prev;
|
||||
a b
|
||||
22 iii
|
||||
handler t1 read a prev;
|
||||
a b
|
||||
21 hhh
|
||||
handler t1 close;
|
||||
handler t1 open as t2;
|
||||
handler t2 read first;
|
||||
a b
|
||||
|
@@ -329,3 +329,28 @@ ERROR 42S21: Duplicate column name 'c1'
|
||||
alter table t1 add key (c1,c1,c2);
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
drop table t1;
|
||||
create table t1 (a varchar(10), b varchar(10), key(a(10),b(10)));
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` varchar(10) default NULL,
|
||||
`b` varchar(10) default NULL,
|
||||
KEY `a` (`a`,`b`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
alter table t1 modify b varchar(20);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` varchar(10) default NULL,
|
||||
`b` varchar(20) default NULL,
|
||||
KEY `a` (`a`,`b`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
alter table t1 modify a varchar(20);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` varchar(20) default NULL,
|
||||
`b` varchar(20) default NULL,
|
||||
KEY `a` (`a`,`b`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
|
@@ -148,3 +148,17 @@ a'b a"b
|
||||
select 'aaa\\','aa''a',"aa""a";
|
||||
aaa\ aa'a aa"a
|
||||
aaa\ aa'a aa"a
|
||||
SET @message = 'Here comes a message';
|
||||
|
||||
Here comes a message
|
||||
--------------------
|
||||
SET @message = USER();
|
||||
|
||||
root@localhost
|
||||
--------------
|
||||
SET @message = 'Here comes a very very long message that is longer then 80 characters
|
||||
on multiple lines';
|
||||
|
||||
Here comes a very very long message that is longer then 80 characters
|
||||
on multiple lines
|
||||
--------------------------------------------------------------------------------
|
||||
|
@@ -88,7 +88,7 @@ TV NULL NULL 600
|
||||
NULL NULL NULL 7785
|
||||
explain extended select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using temporary; Using filesort
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 15 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`product` AS `product`,`test`.`t1`.`country_id` AS `country_id`,`test`.`t1`.`year` AS `year`,sum(`test`.`t1`.`profit`) AS `sum(profit)` from `test`.`t1` group by `test`.`t1`.`product`,`test`.`t1`.`country_id`,`test`.`t1`.`year` with rollup
|
||||
select product, country_id , sum(profit) from t1 group by product desc, country_id with rollup;
|
||||
|
@@ -634,3 +634,44 @@ id
|
||||
3
|
||||
deallocate prepare stmt;
|
||||
drop table t1, t2;
|
||||
create table t1 (a int);
|
||||
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
|
||||
prepare stmt from "select * from t1 limit ?, ?";
|
||||
set @offset=0, @limit=1;
|
||||
execute stmt using @offset, @limit;
|
||||
a
|
||||
1
|
||||
select * from t1 limit 0, 1;
|
||||
a
|
||||
1
|
||||
set @offset=3, @limit=2;
|
||||
execute stmt using @offset, @limit;
|
||||
a
|
||||
4
|
||||
5
|
||||
select * from t1 limit 3, 2;
|
||||
a
|
||||
4
|
||||
5
|
||||
prepare stmt from "select * from t1 limit ?";
|
||||
execute stmt using @limit;
|
||||
a
|
||||
1
|
||||
2
|
||||
prepare stmt from "select * from t1 where a in (select a from t1 limit ?)";
|
||||
ERROR 42000: This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
|
||||
prepare stmt from "select * from t1 union all select * from t1 limit ?, ?";
|
||||
set @offset=9;
|
||||
set @limit=2;
|
||||
execute stmt using @offset, @limit;
|
||||
a
|
||||
10
|
||||
1
|
||||
prepare stmt from "(select * from t1 limit ?, ?) union all
|
||||
(select * from t1 limit ?, ?) order by a limit ?";
|
||||
execute stmt using @offset, @limit, @offset, @limit, @limit;
|
||||
a
|
||||
10
|
||||
10
|
||||
drop table t1;
|
||||
deallocate prepare stmt;
|
||||
|
@@ -471,13 +471,13 @@ execute stmt1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def id 8 3 1 N 32929 0 63
|
||||
def select_type 253 19 6 N 1 31 8
|
||||
def table 253 64 2 N 1 31 8
|
||||
def type 253 10 3 N 1 31 8
|
||||
def table 253 64 2 Y 0 31 8
|
||||
def type 253 10 3 Y 0 31 8
|
||||
def possible_keys 253 4096 0 Y 0 31 8
|
||||
def key 253 64 0 Y 0 31 8
|
||||
def key_len 253 4096 0 Y 128 31 63
|
||||
def ref 253 1024 0 Y 0 31 8
|
||||
def rows 8 10 1 N 32929 0 63
|
||||
def rows 8 10 1 Y 32928 0 63
|
||||
def Extra 253 255 14 N 1 31 8
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
|
||||
@@ -487,13 +487,13 @@ execute stmt1 using @arg00;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def id 8 3 1 N 32929 0 63
|
||||
def select_type 253 19 6 N 1 31 8
|
||||
def table 253 64 2 N 1 31 8
|
||||
def type 253 10 5 N 1 31 8
|
||||
def table 253 64 2 Y 0 31 8
|
||||
def type 253 10 5 Y 0 31 8
|
||||
def possible_keys 253 4096 7 Y 0 31 8
|
||||
def key 253 64 7 Y 0 31 8
|
||||
def key_len 253 4096 1 Y 128 31 63
|
||||
def ref 253 1024 0 Y 0 31 8
|
||||
def rows 8 10 1 N 32929 0 63
|
||||
def rows 8 10 1 Y 32928 0 63
|
||||
def Extra 253 255 27 N 1 31 8
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using filesort
|
||||
|
@@ -444,9 +444,10 @@ limit 1 ';
|
||||
execute stmt1 ;
|
||||
a b
|
||||
1 one
|
||||
prepare stmt1 from ' select a,b from t1
|
||||
limit ? ';
|
||||
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 2
|
||||
prepare stmt1 from ' select a,b from t1 limit ? ';
|
||||
execute stmt1 using @arg00;
|
||||
a b
|
||||
1 one
|
||||
set @arg00='b' ;
|
||||
set @arg01=0 ;
|
||||
set @arg02=2 ;
|
||||
@@ -1151,13 +1152,13 @@ execute stmt1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def id 8 3 1 N 32929 0 63
|
||||
def select_type 253 19 6 N 1 31 8
|
||||
def table 253 64 2 N 1 31 8
|
||||
def type 253 10 3 N 1 31 8
|
||||
def table 253 64 2 Y 0 31 8
|
||||
def type 253 10 3 Y 0 31 8
|
||||
def possible_keys 253 4096 0 Y 0 31 8
|
||||
def key 253 64 0 Y 0 31 8
|
||||
def key_len 253 4096 0 Y 128 31 63
|
||||
def ref 253 1024 0 Y 0 31 8
|
||||
def rows 8 10 1 N 32929 0 63
|
||||
def rows 8 10 1 Y 32928 0 63
|
||||
def Extra 253 255 0 N 1 31 8
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
|
||||
@@ -1381,10 +1382,8 @@ execute stmt1 ;
|
||||
select a,b from t1 where b = 'bla' ;
|
||||
a b
|
||||
2 bla
|
||||
prepare stmt1 from 'update t1 set b=''bla''
|
||||
where a=2
|
||||
limit ?';
|
||||
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 3
|
||||
prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
|
||||
execute stmt1 using @arg00;
|
||||
test_sequence
|
||||
------ insert tests ------
|
||||
delete from t1 ;
|
||||
|
@@ -444,9 +444,10 @@ limit 1 ';
|
||||
execute stmt1 ;
|
||||
a b
|
||||
1 one
|
||||
prepare stmt1 from ' select a,b from t1
|
||||
limit ? ';
|
||||
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 2
|
||||
prepare stmt1 from ' select a,b from t1 limit ? ';
|
||||
execute stmt1 using @arg00;
|
||||
a b
|
||||
1 one
|
||||
set @arg00='b' ;
|
||||
set @arg01=0 ;
|
||||
set @arg02=2 ;
|
||||
@@ -1151,13 +1152,13 @@ execute stmt1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def id 8 3 1 N 32929 0 63
|
||||
def select_type 253 19 6 N 1 31 8
|
||||
def table 253 64 2 N 1 31 8
|
||||
def type 253 10 3 N 1 31 8
|
||||
def table 253 64 2 Y 0 31 8
|
||||
def type 253 10 3 Y 0 31 8
|
||||
def possible_keys 253 4096 0 Y 0 31 8
|
||||
def key 253 64 0 Y 0 31 8
|
||||
def key_len 253 4096 0 Y 128 31 63
|
||||
def ref 253 1024 0 Y 0 31 8
|
||||
def rows 8 10 1 N 32929 0 63
|
||||
def rows 8 10 1 Y 32928 0 63
|
||||
def Extra 253 255 0 N 1 31 8
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
|
||||
@@ -1364,10 +1365,8 @@ execute stmt1 ;
|
||||
select a,b from t1 where b = 'bla' ;
|
||||
a b
|
||||
2 bla
|
||||
prepare stmt1 from 'update t1 set b=''bla''
|
||||
where a=2
|
||||
limit ?';
|
||||
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 3
|
||||
prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
|
||||
execute stmt1 using @arg00;
|
||||
test_sequence
|
||||
------ insert tests ------
|
||||
delete from t1 ;
|
||||
|
@@ -445,9 +445,10 @@ limit 1 ';
|
||||
execute stmt1 ;
|
||||
a b
|
||||
1 one
|
||||
prepare stmt1 from ' select a,b from t1
|
||||
limit ? ';
|
||||
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 2
|
||||
prepare stmt1 from ' select a,b from t1 limit ? ';
|
||||
execute stmt1 using @arg00;
|
||||
a b
|
||||
1 one
|
||||
set @arg00='b' ;
|
||||
set @arg01=0 ;
|
||||
set @arg02=2 ;
|
||||
@@ -1152,13 +1153,13 @@ execute stmt1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def id 8 3 1 N 32929 0 63
|
||||
def select_type 253 19 6 N 1 31 8
|
||||
def table 253 64 2 N 1 31 8
|
||||
def type 253 10 3 N 1 31 8
|
||||
def table 253 64 2 Y 0 31 8
|
||||
def type 253 10 3 Y 0 31 8
|
||||
def possible_keys 253 4096 0 Y 0 31 8
|
||||
def key 253 64 0 Y 0 31 8
|
||||
def key_len 253 4096 0 Y 128 31 63
|
||||
def ref 253 1024 0 Y 0 31 8
|
||||
def rows 8 10 1 N 32929 0 63
|
||||
def rows 8 10 1 Y 32928 0 63
|
||||
def Extra 253 255 0 N 1 31 8
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
|
||||
@@ -1365,10 +1366,8 @@ execute stmt1 ;
|
||||
select a,b from t1 where b = 'bla' ;
|
||||
a b
|
||||
2 bla
|
||||
prepare stmt1 from 'update t1 set b=''bla''
|
||||
where a=2
|
||||
limit ?';
|
||||
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 3
|
||||
prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
|
||||
execute stmt1 using @arg00;
|
||||
test_sequence
|
||||
------ insert tests ------
|
||||
delete from t1 ;
|
||||
|
@@ -487,9 +487,10 @@ limit 1 ';
|
||||
execute stmt1 ;
|
||||
a b
|
||||
1 one
|
||||
prepare stmt1 from ' select a,b from t1
|
||||
limit ? ';
|
||||
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 2
|
||||
prepare stmt1 from ' select a,b from t1 limit ? ';
|
||||
execute stmt1 using @arg00;
|
||||
a b
|
||||
1 one
|
||||
set @arg00='b' ;
|
||||
set @arg01=0 ;
|
||||
set @arg02=2 ;
|
||||
@@ -1194,13 +1195,13 @@ execute stmt1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def id 8 3 1 N 32929 0 63
|
||||
def select_type 253 19 6 N 1 31 8
|
||||
def table 253 64 2 N 1 31 8
|
||||
def type 253 10 3 N 1 31 8
|
||||
def table 253 64 2 Y 0 31 8
|
||||
def type 253 10 3 Y 0 31 8
|
||||
def possible_keys 253 4096 0 Y 0 31 8
|
||||
def key 253 64 0 Y 0 31 8
|
||||
def key_len 253 4096 0 Y 128 31 63
|
||||
def ref 253 1024 0 Y 0 31 8
|
||||
def rows 8 10 1 N 32929 0 63
|
||||
def rows 8 10 1 Y 32928 0 63
|
||||
def Extra 253 255 0 N 1 31 8
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
|
||||
@@ -1407,10 +1408,8 @@ execute stmt1 ;
|
||||
select a,b from t1 where b = 'bla' ;
|
||||
a b
|
||||
2 bla
|
||||
prepare stmt1 from 'update t1 set b=''bla''
|
||||
where a=2
|
||||
limit ?';
|
||||
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 3
|
||||
prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
|
||||
execute stmt1 using @arg00;
|
||||
test_sequence
|
||||
------ insert tests ------
|
||||
delete from t1 ;
|
||||
@@ -3500,9 +3499,10 @@ limit 1 ';
|
||||
execute stmt1 ;
|
||||
a b
|
||||
1 one
|
||||
prepare stmt1 from ' select a,b from t1
|
||||
limit ? ';
|
||||
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 2
|
||||
prepare stmt1 from ' select a,b from t1 limit ? ';
|
||||
execute stmt1 using @arg00;
|
||||
a b
|
||||
1 one
|
||||
set @arg00='b' ;
|
||||
set @arg01=0 ;
|
||||
set @arg02=2 ;
|
||||
@@ -4207,13 +4207,13 @@ execute stmt1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def id 8 3 1 N 32929 0 63
|
||||
def select_type 253 19 6 N 1 31 8
|
||||
def table 253 64 2 N 1 31 8
|
||||
def type 253 10 3 N 1 31 8
|
||||
def table 253 64 2 Y 0 31 8
|
||||
def type 253 10 3 Y 0 31 8
|
||||
def possible_keys 253 4096 0 Y 0 31 8
|
||||
def key 253 64 0 Y 0 31 8
|
||||
def key_len 253 4096 0 Y 128 31 63
|
||||
def ref 253 1024 0 Y 0 31 8
|
||||
def rows 8 10 1 N 32929 0 63
|
||||
def rows 8 10 1 Y 32928 0 63
|
||||
def Extra 253 255 0 N 1 31 8
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
|
||||
@@ -4420,10 +4420,8 @@ execute stmt1 ;
|
||||
select a,b from t1 where b = 'bla' ;
|
||||
a b
|
||||
2 bla
|
||||
prepare stmt1 from 'update t1 set b=''bla''
|
||||
where a=2
|
||||
limit ?';
|
||||
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 3
|
||||
prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
|
||||
execute stmt1 using @arg00;
|
||||
test_sequence
|
||||
------ insert tests ------
|
||||
delete from t1 ;
|
||||
|
@@ -444,9 +444,10 @@ limit 1 ';
|
||||
execute stmt1 ;
|
||||
a b
|
||||
1 one
|
||||
prepare stmt1 from ' select a,b from t1
|
||||
limit ? ';
|
||||
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 2
|
||||
prepare stmt1 from ' select a,b from t1 limit ? ';
|
||||
execute stmt1 using @arg00;
|
||||
a b
|
||||
1 one
|
||||
set @arg00='b' ;
|
||||
set @arg01=0 ;
|
||||
set @arg02=2 ;
|
||||
@@ -1151,13 +1152,13 @@ execute stmt1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def id 8 3 1 N 32929 0 63
|
||||
def select_type 253 19 6 N 1 31 8
|
||||
def table 253 64 2 N 1 31 8
|
||||
def type 253 10 3 N 1 31 8
|
||||
def table 253 64 2 Y 0 31 8
|
||||
def type 253 10 3 Y 0 31 8
|
||||
def possible_keys 253 4096 0 Y 0 31 8
|
||||
def key 253 64 0 Y 0 31 8
|
||||
def key_len 253 4096 0 Y 128 31 63
|
||||
def ref 253 1024 0 Y 0 31 8
|
||||
def rows 8 10 1 N 32929 0 63
|
||||
def rows 8 10 1 Y 32928 0 63
|
||||
def Extra 253 255 0 N 1 31 8
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t9 ALL NULL NULL NULL NULL 3
|
||||
@@ -1364,10 +1365,8 @@ execute stmt1 ;
|
||||
select a,b from t1 where b = 'bla' ;
|
||||
a b
|
||||
2 bla
|
||||
prepare stmt1 from 'update t1 set b=''bla''
|
||||
where a=2
|
||||
limit ?';
|
||||
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 3
|
||||
prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
|
||||
execute stmt1 using @arg00;
|
||||
test_sequence
|
||||
------ insert tests ------
|
||||
delete from t1 ;
|
||||
|
@@ -444,9 +444,10 @@ limit 1 ';
|
||||
execute stmt1 ;
|
||||
a b
|
||||
1 one
|
||||
prepare stmt1 from ' select a,b from t1
|
||||
limit ? ';
|
||||
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 2
|
||||
prepare stmt1 from ' select a,b from t1 limit ? ';
|
||||
execute stmt1 using @arg00;
|
||||
a b
|
||||
3 three
|
||||
set @arg00='b' ;
|
||||
set @arg01=0 ;
|
||||
set @arg02=2 ;
|
||||
@@ -1151,13 +1152,13 @@ execute stmt1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def id 8 3 1 N 32929 0 63
|
||||
def select_type 253 19 6 N 1 31 8
|
||||
def table 253 64 2 N 1 31 8
|
||||
def type 253 10 3 N 1 31 8
|
||||
def table 253 64 2 Y 0 31 8
|
||||
def type 253 10 3 Y 0 31 8
|
||||
def possible_keys 253 4096 0 Y 0 31 8
|
||||
def key 253 64 0 Y 0 31 8
|
||||
def key_len 253 4096 0 Y 128 31 63
|
||||
def ref 253 1024 0 Y 0 31 8
|
||||
def rows 8 10 1 N 32929 0 63
|
||||
def rows 8 10 1 Y 32928 0 63
|
||||
def Extra 253 255 0 N 1 31 8
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
|
||||
@@ -1364,10 +1365,8 @@ execute stmt1 ;
|
||||
select a,b from t1 where b = 'bla' ;
|
||||
a b
|
||||
2 bla
|
||||
prepare stmt1 from 'update t1 set b=''bla''
|
||||
where a=2
|
||||
limit ?';
|
||||
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 3
|
||||
prepare stmt1 from 'update t1 set b=''bla'' where a=2 limit ?';
|
||||
execute stmt1 using @arg00;
|
||||
test_sequence
|
||||
------ insert tests ------
|
||||
delete from t1 ;
|
||||
|
@@ -2682,3 +2682,20 @@ AND FK_firma_id = 2;
|
||||
COUNT(*)
|
||||
0
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (a int);
|
||||
CREATE TABLE t2 (a int);
|
||||
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
|
||||
INSERT INTO t2 VALUES (2), (4), (6);
|
||||
SELECT t1.a FROM t1 STRAIGHT_JOIN t2 ON t1.a=t2.a;
|
||||
a
|
||||
2
|
||||
4
|
||||
EXPLAIN SELECT t1.a FROM t1 STRAIGHT_JOIN t2 ON t1.a=t2.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
|
||||
EXPLAIN SELECT t1.a FROM t1 INNER JOIN t2 ON t1.a=t2.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where
|
||||
DROP TABLE t1,t2;
|
||||
|
@@ -672,3 +672,17 @@ select default(t30.s1) from t30;
|
||||
end|
|
||||
drop procedure bug10969|
|
||||
drop table t1|
|
||||
prepare stmt from "select 1";
|
||||
create procedure p() deallocate prepare stmt;
|
||||
ERROR 0A000: DEALLOCATE is not allowed in stored procedures
|
||||
create function f() returns int begin deallocate prepare stmt;
|
||||
ERROR 0A000: DEALLOCATE is not allowed in stored procedures
|
||||
create procedure p() prepare stmt from "select 1";
|
||||
ERROR 0A000: PREPARE is not allowed in stored procedures
|
||||
create function f() returns int begin prepare stmt from "select 1";
|
||||
ERROR 0A000: PREPARE is not allowed in stored procedures
|
||||
create procedure p() execute stmt;
|
||||
ERROR 0A000: EXECUTE is not allowed in stored procedures
|
||||
create function f() returns int begin execute stmt;
|
||||
ERROR 0A000: EXECUTE is not allowed in stored procedures
|
||||
deallocate prepare stmt;
|
||||
|
@@ -40,3 +40,18 @@ Id User Host db Command Time State Info
|
||||
unlock tables;
|
||||
drop procedure bug9486;
|
||||
drop table t1, t2;
|
||||
drop procedure if exists bug11158;
|
||||
create procedure bug11158() delete t1 from t1, t2 where t1.id = t2.id;
|
||||
create table t1 (id int, j int);
|
||||
insert into t1 values (1, 1), (2, 2);
|
||||
create table t2 (id int);
|
||||
insert into t2 values (1);
|
||||
call bug11158();
|
||||
select * from t1;
|
||||
id j
|
||||
2 2
|
||||
lock tables t2 read;
|
||||
call bug11158();
|
||||
unlock tables;
|
||||
drop procedure bug11158;
|
||||
drop table t1, t2;
|
||||
|
@@ -3134,4 +3134,44 @@ x
|
||||
x
|
||||
3
|
||||
drop procedure bug10961|
|
||||
DROP PROCEDURE IF EXISTS bug6866|
|
||||
DROP VIEW IF EXISTS tv|
|
||||
Warnings:
|
||||
Note 1051 Unknown table 'test.tv'
|
||||
DROP TABLE IF EXISTS tt1,tt2,tt3|
|
||||
Warnings:
|
||||
Note 1051 Unknown table 'tt1'
|
||||
Note 1051 Unknown table 'tt2'
|
||||
Note 1051 Unknown table 'tt3'
|
||||
CREATE TABLE tt1 (a1 int, a2 int, a3 int, data varchar(10))|
|
||||
CREATE TABLE tt2 (a2 int, data2 varchar(10))|
|
||||
CREATE TABLE tt3 (a3 int, data3 varchar(10))|
|
||||
INSERT INTO tt1 VALUES (1, 1, 4, 'xx')|
|
||||
INSERT INTO tt2 VALUES (1, 'a')|
|
||||
INSERT INTO tt2 VALUES (2, 'b')|
|
||||
INSERT INTO tt2 VALUES (3, 'c')|
|
||||
INSERT INTO tt3 VALUES (4, 'd')|
|
||||
INSERT INTO tt3 VALUES (5, 'e')|
|
||||
INSERT INTO tt3 VALUES (6, 'f')|
|
||||
CREATE VIEW tv AS
|
||||
SELECT tt1.*, tt2.data2, tt3.data3
|
||||
FROM tt1 INNER JOIN tt2 ON tt1.a2 = tt2.a2
|
||||
LEFT JOIN tt3 ON tt1.a3 = tt3.a3
|
||||
ORDER BY tt1.a1, tt2.a2, tt3.a3|
|
||||
CREATE PROCEDURE bug6866 (_a1 int)
|
||||
BEGIN
|
||||
SELECT * FROM tv WHERE a1 = _a1;
|
||||
END|
|
||||
CALL bug6866(1)|
|
||||
a1 a2 a3 data data2 data3
|
||||
1 1 4 xx a d
|
||||
CALL bug6866(1)|
|
||||
a1 a2 a3 data data2 data3
|
||||
1 1 4 xx a d
|
||||
CALL bug6866(1)|
|
||||
a1 a2 a3 data data2 data3
|
||||
1 1 4 xx a d
|
||||
DROP PROCEDURE bug6866;
|
||||
DROP VIEW tv|
|
||||
DROP TABLE tt1, tt2, tt3|
|
||||
drop table t1,t2;
|
||||
|
@@ -1,3 +1,4 @@
|
||||
drop table if exists t1, t2;
|
||||
drop procedure if exists bug8850|
|
||||
create table t1 (a int) engine=innodb|
|
||||
create procedure bug8850()
|
||||
@@ -20,3 +21,160 @@ a
|
||||
2
|
||||
drop table t1|
|
||||
drop procedure bug8850|
|
||||
drop function if exists bug10015_1|
|
||||
drop function if exists bug10015_2|
|
||||
drop function if exists bug10015_3|
|
||||
drop function if exists bug10015_4|
|
||||
drop function if exists bug10015_5|
|
||||
drop function if exists bug10015_6|
|
||||
drop function if exists bug10015_7|
|
||||
drop procedure if exists bug10015_8|
|
||||
create table t1 (id int) engine=innodb|
|
||||
create table t2 (id int primary key, j int) engine=innodb|
|
||||
insert into t1 values (1),(2),(3)|
|
||||
create function bug10015_1() returns int return (select count(*) from t1)|
|
||||
select *, bug10015_1() from t1|
|
||||
id bug10015_1()
|
||||
1 3
|
||||
2 3
|
||||
3 3
|
||||
drop function bug10015_1|
|
||||
create function bug10015_2() returns int
|
||||
begin
|
||||
declare i, s int;
|
||||
set i:= (select min(id) from t1);
|
||||
set s:= (select max(id) from t1);
|
||||
return (s - i);
|
||||
end|
|
||||
select *, bug10015_2() from t1|
|
||||
id bug10015_2()
|
||||
1 2
|
||||
2 2
|
||||
3 2
|
||||
drop function bug10015_2|
|
||||
create function bug10015_3() returns int
|
||||
return (select max(a.id - b.id) from t1 as a, t1 as b where a.id >= b.id)|
|
||||
select *, bug10015_3() from t1|
|
||||
id bug10015_3()
|
||||
1 2
|
||||
2 2
|
||||
3 2
|
||||
drop function bug10015_3|
|
||||
create function bug10015_4(i int) returns int
|
||||
begin
|
||||
declare m int;
|
||||
set m:= (select max(id) from t2);
|
||||
insert into t2 values (i, m);
|
||||
return m;
|
||||
end|
|
||||
select *, bug10015_4(id) from t1|
|
||||
id bug10015_4(id)
|
||||
1 NULL
|
||||
2 1
|
||||
3 2
|
||||
select * from t2|
|
||||
id j
|
||||
1 NULL
|
||||
2 1
|
||||
3 2
|
||||
drop function bug10015_4|
|
||||
create function bug10015_5(i int) returns int
|
||||
begin
|
||||
if (i = 5) then
|
||||
insert into t2 values (1, 0);
|
||||
end if;
|
||||
return i;
|
||||
end|
|
||||
insert into t1 values (bug10015_5(4)), (bug10015_5(5))|
|
||||
ERROR 23000: Duplicate entry '1' for key 1
|
||||
select * from t1|
|
||||
id
|
||||
1
|
||||
2
|
||||
3
|
||||
drop function bug10015_5|
|
||||
create function bug10015_6(i int) returns int
|
||||
begin
|
||||
declare continue handler for sqlexception set @error_in_func:= 1;
|
||||
if (i = 5) then
|
||||
insert into t2 values (4, 0), (1, 0);
|
||||
end if;
|
||||
return i;
|
||||
end|
|
||||
set @error_in_func:= 0|
|
||||
insert into t1 values (bug10015_6(5)), (bug10015_6(6))|
|
||||
select @error_in_func|
|
||||
@error_in_func
|
||||
1
|
||||
select * from t1|
|
||||
id
|
||||
1
|
||||
2
|
||||
3
|
||||
5
|
||||
6
|
||||
select * from t2|
|
||||
id j
|
||||
1 NULL
|
||||
2 1
|
||||
3 2
|
||||
4 0
|
||||
drop function bug10015_6|
|
||||
create function bug10015_7() returns int
|
||||
begin
|
||||
alter table t1 add k int;
|
||||
return 1;
|
||||
end|
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
create function bug10015_7() returns int
|
||||
begin
|
||||
start transaction;
|
||||
return 1;
|
||||
end|
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
create function bug10015_7() returns int
|
||||
begin
|
||||
drop table t1;
|
||||
return 1;
|
||||
end|
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
create function bug10015_7() returns int
|
||||
begin
|
||||
drop temporary table t1;
|
||||
return 1;
|
||||
end|
|
||||
drop function bug10015_7|
|
||||
create function bug10015_7() returns int
|
||||
begin
|
||||
commit;
|
||||
return 1;
|
||||
end|
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
create function bug10015_7() returns int
|
||||
begin
|
||||
call bug10015_8();
|
||||
return 1;
|
||||
end|
|
||||
create procedure bug10015_8() alter table t1 add k int|
|
||||
select *, bug10015_7() from t1|
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
drop procedure bug10015_8|
|
||||
create procedure bug10015_8() start transaction|
|
||||
select *, bug10015_7() from t1|
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
drop procedure bug10015_8|
|
||||
create procedure bug10015_8() drop temporary table if exists t1_temp|
|
||||
select *, bug10015_7() from t1|
|
||||
id bug10015_7()
|
||||
1 1
|
||||
2 1
|
||||
3 1
|
||||
5 1
|
||||
6 1
|
||||
drop procedure bug10015_8|
|
||||
create procedure bug10015_8() commit|
|
||||
select *, bug10015_7() from t1|
|
||||
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
|
||||
drop procedure bug10015_8|
|
||||
drop function bug10015_7|
|
||||
drop table t1, t2|
|
||||
|
@@ -138,6 +138,8 @@ t1 CREATE TABLE `t1` (
|
||||
`min_num` decimal(7,6) default '0.000001'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1 ;
|
||||
set @@SQL_MODE=NULL;
|
||||
ERROR 42000: Variable 'sql_mode' can't be set to the value of 'NULL'
|
||||
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='';
|
||||
show local variables like 'SQL_MODE';
|
||||
Variable_name Value
|
||||
|
@@ -458,3 +458,11 @@ select h from t1;
|
||||
h
|
||||
a
|
||||
drop table t1;
|
||||
create table t1 (a bit(8)) engine=heap;
|
||||
insert into t1 values ('1111100000');
|
||||
Warnings:
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 1
|
||||
select a+0 from t1;
|
||||
a+0
|
||||
255
|
||||
drop table t1;
|
||||
|
@@ -414,8 +414,8 @@ Warning 1264 Out of range value adjusted for column 'a' at row 2
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 7
|
||||
select * from t1;
|
||||
a
|
||||
9999999999
|
||||
9999999999
|
||||
0
|
||||
0
|
||||
1
|
||||
1
|
||||
1
|
||||
@@ -430,8 +430,8 @@ Warning 1264 Out of range value adjusted for column 'a' at row 2
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 7
|
||||
select * from t1;
|
||||
a
|
||||
9999999999
|
||||
9999999999
|
||||
0000000000
|
||||
0000000000
|
||||
0000000001
|
||||
0000000001
|
||||
0000000001
|
||||
@@ -446,8 +446,8 @@ Warning 1264 Out of range value adjusted for column 'a' at row 2
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 7
|
||||
select * from t1;
|
||||
a
|
||||
9999999999
|
||||
9999999999
|
||||
0000000000
|
||||
0000000000
|
||||
0000000001
|
||||
0000000001
|
||||
0000000001
|
||||
|
@@ -119,7 +119,7 @@ a
|
||||
99.99
|
||||
99.99
|
||||
99.99
|
||||
99.99
|
||||
0.00
|
||||
0.00
|
||||
0.00
|
||||
0.00
|
||||
@@ -891,3 +891,40 @@ NULL
|
||||
select abs(NULL);
|
||||
abs(NULL)
|
||||
NULL
|
||||
set @@sql_mode='traditional';
|
||||
create table t1( d1 decimal(18) unsigned, d2 decimal(20) unsigned, d3 decimal (22) unsigned);
|
||||
insert into t1 values(1,-1,-1);
|
||||
ERROR 22003: Out of range value adjusted for column 'd2' at row 1
|
||||
drop table t1;
|
||||
create table t1 (col1 decimal(5,2), col2 numeric(5,2));
|
||||
insert into t1 values (999.999,999.999);
|
||||
ERROR 22003: Out of range value adjusted for column 'col1' at row 1
|
||||
insert into t1 values (-999.999,-999.999);
|
||||
ERROR 22003: Out of range value adjusted for column 'col1' at row 1
|
||||
select * from t1;
|
||||
col1 col2
|
||||
drop table t1;
|
||||
set sql_mode='';
|
||||
set @sav_dpi= @@div_precision_increment;
|
||||
set @@div_precision_increment=15;
|
||||
create table t1 (col1 int, col2 decimal(30,25), col3 numeric(30,25));
|
||||
insert into t1 values (1,0.0123456789012345678912345,0.0123456789012345678912345);
|
||||
select col2/9999999999 from t1 where col1=1;
|
||||
col2/9999999999
|
||||
0.000000000001234567890246913578
|
||||
select 9999999999/col2 from t1 where col1=1;
|
||||
9999999999/col2
|
||||
810000007209.000065537105051
|
||||
select 77777777/7777777;
|
||||
77777777/7777777
|
||||
10.000000900000090
|
||||
drop table t1;
|
||||
set div_precision_increment= @sav_dpi;
|
||||
create table t1 (a decimal(4,2));
|
||||
insert into t1 values (0.00);
|
||||
select * from t1 where a > -0.00;
|
||||
a
|
||||
select * from t1 where a = -0.00;
|
||||
a
|
||||
0.00
|
||||
drop table t1;
|
||||
|
@@ -126,13 +126,13 @@ Some sample data
|
||||
Some samples
|
||||
explain select * from t1 where v like 'This is a test' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort
|
||||
1 SIMPLE t1 range v v 258 NULL 3 Using where; Using index
|
||||
explain select * from t1 where v='This is a test' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref v v 257 const 3 Using where
|
||||
1 SIMPLE t1 ref v v 258 const 3 Using where; Using index
|
||||
explain select * from t1 where v like 'S%' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort
|
||||
1 SIMPLE t1 range v v 258 NULL 2 Using where; Using index
|
||||
alter table t1 change v v varchar(256);
|
||||
select * from t1 where v like 'This is a test' order by v;
|
||||
v
|
||||
@@ -150,13 +150,13 @@ Some sample data
|
||||
Some samples
|
||||
explain select * from t1 where v like 'This is a test' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort
|
||||
1 SIMPLE t1 range v v 259 NULL 3 Using where; Using index
|
||||
explain select * from t1 where v='This is a test' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref v v 257 const 3 Using where
|
||||
1 SIMPLE t1 ref v v 259 const 3 Using where; Using index
|
||||
explain select * from t1 where v like 'S%' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort
|
||||
1 SIMPLE t1 range v v 259 NULL 2 Using where; Using index
|
||||
alter table t1 change v v varchar(257);
|
||||
select * from t1 where v like 'This is a test' order by v;
|
||||
v
|
||||
@@ -174,13 +174,13 @@ Some sample data
|
||||
Some samples
|
||||
explain select * from t1 where v like 'This is a test' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort
|
||||
1 SIMPLE t1 range v v 260 NULL 3 Using where; Using index
|
||||
explain select * from t1 where v='This is a test' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref v v 257 const 3 Using where
|
||||
1 SIMPLE t1 ref v v 260 const 3 Using where; Using index
|
||||
explain select * from t1 where v like 'S%' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort
|
||||
1 SIMPLE t1 range v v 260 NULL 2 Using where; Using index
|
||||
alter table t1 change v v varchar(258);
|
||||
select * from t1 where v like 'This is a test' order by v;
|
||||
v
|
||||
@@ -198,13 +198,13 @@ Some sample data
|
||||
Some samples
|
||||
explain select * from t1 where v like 'This is a test' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort
|
||||
1 SIMPLE t1 range v v 261 NULL 3 Using where; Using index
|
||||
explain select * from t1 where v='This is a test' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref v v 257 const 3 Using where
|
||||
1 SIMPLE t1 ref v v 261 const 3 Using where; Using index
|
||||
explain select * from t1 where v like 'S%' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort
|
||||
1 SIMPLE t1 range v v 261 NULL 2 Using where; Using index
|
||||
alter table t1 change v v varchar(259);
|
||||
select * from t1 where v like 'This is a test' order by v;
|
||||
v
|
||||
@@ -222,13 +222,13 @@ Some sample data
|
||||
Some samples
|
||||
explain select * from t1 where v like 'This is a test' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort
|
||||
1 SIMPLE t1 range v v 262 NULL 3 Using where; Using index
|
||||
explain select * from t1 where v='This is a test' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref v v 257 const 3 Using where
|
||||
1 SIMPLE t1 ref v v 262 const 3 Using where; Using index
|
||||
explain select * from t1 where v like 'S%' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort
|
||||
1 SIMPLE t1 range v v 262 NULL 2 Using where; Using index
|
||||
alter table t1 change v v varchar(258);
|
||||
select * from t1 where v like 'This is a test' order by v;
|
||||
v
|
||||
@@ -246,13 +246,13 @@ Some sample data
|
||||
Some samples
|
||||
explain select * from t1 where v like 'This is a test' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort
|
||||
1 SIMPLE t1 range v v 261 NULL 3 Using where; Using index
|
||||
explain select * from t1 where v='This is a test' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref v v 257 const 3 Using where
|
||||
1 SIMPLE t1 ref v v 261 const 3 Using where; Using index
|
||||
explain select * from t1 where v like 'S%' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort
|
||||
1 SIMPLE t1 range v v 261 NULL 2 Using where; Using index
|
||||
alter table t1 change v v varchar(257);
|
||||
select * from t1 where v like 'This is a test' order by v;
|
||||
v
|
||||
@@ -270,13 +270,13 @@ Some sample data
|
||||
Some samples
|
||||
explain select * from t1 where v like 'This is a test' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort
|
||||
1 SIMPLE t1 range v v 260 NULL 3 Using where; Using index
|
||||
explain select * from t1 where v='This is a test' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref v v 257 const 3 Using where
|
||||
1 SIMPLE t1 ref v v 260 const 3 Using where; Using index
|
||||
explain select * from t1 where v like 'S%' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort
|
||||
1 SIMPLE t1 range v v 260 NULL 2 Using where; Using index
|
||||
alter table t1 change v v varchar(256);
|
||||
select * from t1 where v like 'This is a test' order by v;
|
||||
v
|
||||
@@ -294,13 +294,13 @@ Some sample data
|
||||
Some samples
|
||||
explain select * from t1 where v like 'This is a test' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort
|
||||
1 SIMPLE t1 range v v 259 NULL 3 Using where; Using index
|
||||
explain select * from t1 where v='This is a test' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref v v 257 const 3 Using where
|
||||
1 SIMPLE t1 ref v v 259 const 3 Using where; Using index
|
||||
explain select * from t1 where v like 'S%' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort
|
||||
1 SIMPLE t1 range v v 259 NULL 2 Using where; Using index
|
||||
alter table t1 change v v varchar(255);
|
||||
select * from t1 where v like 'This is a test' order by v;
|
||||
v
|
||||
@@ -318,13 +318,13 @@ Some sample data
|
||||
Some samples
|
||||
explain select * from t1 where v like 'This is a test' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range v v 257 NULL 3 Using where; Using filesort
|
||||
1 SIMPLE t1 range v v 258 NULL 3 Using where; Using index
|
||||
explain select * from t1 where v='This is a test' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref v v 257 const 3 Using where
|
||||
1 SIMPLE t1 ref v v 258 const 3 Using where; Using index
|
||||
explain select * from t1 where v like 'S%' order by v;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range v v 257 NULL 2 Using where; Using filesort
|
||||
1 SIMPLE t1 range v v 258 NULL 2 Using where; Using index
|
||||
alter table t1 change v v varchar(254);
|
||||
select * from t1 where v like 'This is a test' order by v;
|
||||
v
|
||||
@@ -392,3 +392,26 @@ group by t1.b, t1.a;
|
||||
a b min(t1.b)
|
||||
22 NULL NULL
|
||||
drop table t1, t2;
|
||||
create table t1 (f1 varchar(65500));
|
||||
create index index1 on t1(f1(10));
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` varchar(65500) default NULL,
|
||||
KEY `index1` (`f1`(10))
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
alter table t1 modify f1 varchar(255);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` varchar(255) default NULL,
|
||||
KEY `index1` (`f1`(10))
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
alter table t1 modify f1 tinytext;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` tinytext,
|
||||
KEY `index1` (`f1`(10))
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
|
@@ -181,3 +181,56 @@ drop table t1;
|
||||
set table_type=MYISAM;
|
||||
Warnings:
|
||||
Warning 1287 'table_type' is deprecated; use 'storage_engine' instead
|
||||
create table t1 (a int);
|
||||
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
|
||||
update t1 set a='abc';
|
||||
Warnings:
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 1
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 2
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 3
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 4
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 5
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 6
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 7
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 8
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 9
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 10
|
||||
show warnings limit 2, 1;
|
||||
Level Code Message
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 3
|
||||
show warnings limit 0, 10;
|
||||
Level Code Message
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 1
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 2
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 3
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 4
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 5
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 6
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 7
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 8
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 9
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 10
|
||||
show warnings limit 9, 1;
|
||||
Level Code Message
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 10
|
||||
show warnings limit 10, 1;
|
||||
Level Code Message
|
||||
show warnings limit 9, 2;
|
||||
Level Code Message
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 10
|
||||
show warnings limit 0, 0;
|
||||
Level Code Message
|
||||
show warnings limit 1;
|
||||
Level Code Message
|
||||
Warning 1264 Out of range value adjusted for column 'a' at row 1
|
||||
show warnings limit 0;
|
||||
Level Code Message
|
||||
show warnings limit 1, 0;
|
||||
Level Code Message
|
||||
select * from t1 limit 0;
|
||||
a
|
||||
select * from t1 limit 1, 0;
|
||||
a
|
||||
select * from t1 limit 0, 0;
|
||||
a
|
||||
drop table t1;
|
||||
|
Reference in New Issue
Block a user