mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge mysql.com:/home/jimw/my/mysql-5.0-3094
into mysql.com:/home/jimw/my/mysql-5.0-clean
This commit is contained in:
@ -27,3 +27,24 @@ select * from t1;
|
||||
n
|
||||
345
|
||||
drop table t1;
|
||||
create table t1 (c1 int);
|
||||
lock table t1 write;
|
||||
flush tables with read lock;
|
||||
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
|
||||
lock table t1 read;
|
||||
flush tables with read lock;
|
||||
lock table t1 write;
|
||||
ERROR HY000: Can't execute the query because you have a conflicting read lock
|
||||
lock table t1 read;
|
||||
lock table t1 write;
|
||||
ERROR HY000: Can't execute the query because you have a conflicting read lock
|
||||
unlock tables;
|
||||
create table t2 (c1 int);
|
||||
create table t3 (c1 int);
|
||||
lock table t1 read, t2 read, t3 write;
|
||||
flush tables with read lock;
|
||||
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
|
||||
lock table t1 read, t2 read, t3 read;
|
||||
flush tables with read lock;
|
||||
unlock tables;
|
||||
drop table t1, t2, t3;
|
||||
|
@ -1,4 +1,4 @@
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t1,t2,t3;
|
||||
CREATE TABLE t1 (
|
||||
a INT AUTO_INCREMENT PRIMARY KEY,
|
||||
message CHAR(20),
|
||||
@ -158,5 +158,19 @@ where
|
||||
match(c.beitrag) against ('+abc' in boolean mode)
|
||||
order by
|
||||
match(betreff) against ('+abc' in boolean mode) desc;
|
||||
ERROR HY000: The used table type doesn't support FULLTEXT indexes
|
||||
text id betreff
|
||||
(select b.id, b.betreff from t3 b) union
|
||||
(select b.id, b.betreff from t3 b)
|
||||
order by match(betreff) against ('+abc' in boolean mode) desc;
|
||||
id betreff
|
||||
(select b.id, b.betreff from t3 b) union
|
||||
(select b.id, b.betreff from t3 b)
|
||||
order by match(betreff) against ('+abc') desc;
|
||||
ERROR HY000: Can't find FULLTEXT index matching the column list
|
||||
select distinct b.id, b.betreff from t3 b
|
||||
order by match(betreff) against ('+abc' in boolean mode) desc;
|
||||
id betreff
|
||||
select b.id, b.betreff from t3 b group by b.id+1
|
||||
order by match(betreff) against ('+abc' in boolean mode) desc;
|
||||
id betreff
|
||||
drop table t1,t2,t3;
|
||||
|
@ -591,3 +591,6 @@ insert into tables_priv values ('','test_db','mysqltest_1','test_table','test_gr
|
||||
flush privileges;
|
||||
delete from tables_priv where host = '' and user = 'mysqltest_1';
|
||||
flush privileges;
|
||||
set @user123="non-existent";
|
||||
select * from mysql.db where user=@user123;
|
||||
Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv
|
||||
|
@ -751,6 +751,13 @@ COUNT(DISTINCT(t1.id)) comment
|
||||
1 NULL
|
||||
1 a problem
|
||||
DROP TABLE t1, t2;
|
||||
create table t1 (f1 date);
|
||||
insert into t1 values('2005-06-06');
|
||||
insert into t1 values('2005-06-06');
|
||||
select date(left(f1+0,8)) from t1 group by 1;
|
||||
date(left(f1+0,8))
|
||||
2005-06-06
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (n int);
|
||||
INSERT INTO t1 VALUES (1);
|
||||
SELECT n+1 AS n FROM t1 GROUP BY n;
|
||||
|
@ -1343,3 +1343,58 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 0
|
||||
1 SIMPLE t3 ALL NULL NULL NULL NULL 0
|
||||
DROP TABLE t1,t2,t3;
|
||||
CREATE TABLE t1 (goods int(12) NOT NULL, price varchar(128) NOT NULL);
|
||||
INSERT INTO t1 VALUES (23, 2340), (26, 9900);
|
||||
CREATE TABLE t2 (goods int(12), name varchar(50), shop char(2));
|
||||
INSERT INTO t2 VALUES (23, 'as300', 'fr'), (26, 'as600', 'fr');
|
||||
create table t3 (groupid int(12) NOT NULL, goodsid int(12) NOT NULL);
|
||||
INSERT INTO t3 VALUES (3,23), (6,26);
|
||||
CREATE TABLE t4 (groupid int(12));
|
||||
INSERT INTO t4 VALUES (1), (2), (3), (4), (5), (6);
|
||||
SELECT * FROM
|
||||
(SELECT DISTINCT gl.groupid, gp.price
|
||||
FROM t4 gl
|
||||
LEFT JOIN
|
||||
(t3 g INNER JOIN t2 p ON g.goodsid = p.goods
|
||||
INNER JOIN t1 gp ON p.goods = gp.goods)
|
||||
ON gl.groupid = g.groupid and p.shop = 'fr') t;
|
||||
groupid price
|
||||
1 NULL
|
||||
2 NULL
|
||||
3 2340
|
||||
4 NULL
|
||||
5 NULL
|
||||
6 9900
|
||||
CREATE VIEW v1 AS
|
||||
SELECT g.groupid groupid, p.goods goods,
|
||||
p.name name, p.shop shop,
|
||||
gp.price price
|
||||
FROM t3 g INNER JOIN t2 p ON g.goodsid = p.goods
|
||||
INNER JOIN t1 gp on p.goods = gp.goods;
|
||||
CREATE VIEW v2 AS
|
||||
SELECT DISTINCT g.groupid, fr.price
|
||||
FROM t4 g
|
||||
LEFT JOIN
|
||||
v1 fr on g.groupid = fr.groupid and fr.shop = 'fr';
|
||||
SELECT * FROM v2;
|
||||
groupid price
|
||||
1 NULL
|
||||
2 NULL
|
||||
3 2340
|
||||
4 NULL
|
||||
5 NULL
|
||||
6 9900
|
||||
SELECT * FROM
|
||||
(SELECT DISTINCT g.groupid, fr.price
|
||||
FROM t4 g
|
||||
LEFT JOIN
|
||||
v1 fr on g.groupid = fr.groupid and fr.shop = 'fr') t;
|
||||
groupid price
|
||||
1 NULL
|
||||
2 NULL
|
||||
3 2340
|
||||
4 NULL
|
||||
5 NULL
|
||||
6 9900
|
||||
DROP VIEW v1,v2;
|
||||
DROP TABLE t1,t2,t3,t4;
|
||||
|
@ -289,3 +289,9 @@ check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
drop table t1;
|
||||
set @@global.key_buffer_size=0;
|
||||
Warnings:
|
||||
Warning 1438 Cannot drop default keycache
|
||||
select @@global.key_buffer_size;
|
||||
@@global.key_buffer_size
|
||||
2097152
|
||||
|
@ -942,7 +942,7 @@ ROW(1, 1, 'a') IN (select a,b,c from t1)
|
||||
1
|
||||
select ROW(1, 2, 'a') IN (select a,b,c from t1);
|
||||
ROW(1, 2, 'a') IN (select a,b,c from t1)
|
||||
NULL
|
||||
0
|
||||
select ROW(1, 1, 'a') IN (select b,a,c from t1);
|
||||
ROW(1, 1, 'a') IN (select b,a,c from t1)
|
||||
1
|
||||
@ -960,7 +960,7 @@ ROW(1, 1, 'a') IN (select a,b,c from t1 where c='b' or c='a')
|
||||
1
|
||||
select ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a');
|
||||
ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a')
|
||||
NULL
|
||||
0
|
||||
select ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a');
|
||||
ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a')
|
||||
1
|
||||
@ -2709,7 +2709,51 @@ select (1,2,3) = (select * from t1);
|
||||
ERROR 21000: Operand should contain 3 column(s)
|
||||
select (select * from t1) = (1,2,3);
|
||||
ERROR 21000: Operand should contain 2 column(s)
|
||||
drop table t1
|
||||
#;
|
||||
CREATE TABLE `t1` (
|
||||
`itemid` bigint(20) unsigned NOT NULL auto_increment,
|
||||
`sessionid` bigint(20) unsigned default NULL,
|
||||
`time` int(10) unsigned NOT NULL default '0',
|
||||
`type` set('A','D','E','F','G','I','L','N','U') collate latin1_general_ci NOT
|
||||
NULL default '',
|
||||
`data` text collate latin1_general_ci NOT NULL,
|
||||
PRIMARY KEY (`itemid`)
|
||||
) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
|
||||
INSERT INTO `t1` VALUES (1, 1, 1, 'D', '');
|
||||
CREATE TABLE `t2` (
|
||||
`sessionid` bigint(20) unsigned NOT NULL auto_increment,
|
||||
`pid` int(10) unsigned NOT NULL default '0',
|
||||
`date` int(10) unsigned NOT NULL default '0',
|
||||
`ip` varchar(15) collate latin1_general_ci NOT NULL default '',
|
||||
PRIMARY KEY (`sessionid`)
|
||||
) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
|
||||
INSERT INTO `t2` VALUES (1, 1, 1, '10.10.10.1');
|
||||
SELECT s.ip, count( e.itemid ) FROM `t1` e JOIN t2 s ON s.sessionid = e.sessionid WHERE e.sessionid = ( SELECT sessionid FROM t2 ORDER BY sessionid DESC LIMIT 1 ) GROUP BY s.ip HAVING count( e.itemid ) >0 LIMIT 0 , 30;
|
||||
ip count( e.itemid )
|
||||
10.10.10.1 1
|
||||
drop tables t1,t2;
|
||||
create table t1 (fld enum('0','1'));
|
||||
insert into t1 values ('1');
|
||||
select * from (select max(fld) from t1) as foo;
|
||||
max(fld)
|
||||
1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (one int, two int, flag char(1));
|
||||
CREATE TABLE t2 (one int, two int, flag char(1));
|
||||
INSERT INTO t1 VALUES(1,2,'Y'),(2,3,'Y'),(3,4,'Y'),(5,6,'N'),(7,8,'N');
|
||||
INSERT INTO t2 VALUES(1,2,'Y'),(2,3,'Y'),(3,4,'Y'),(5,6,'N'),(7,8,'N');
|
||||
SELECT * FROM t1
|
||||
WHERE ROW(one,two) IN (SELECT DISTINCT one,two FROM t2 WHERE flag = 'N');
|
||||
one two flag
|
||||
5 6 N
|
||||
7 8 N
|
||||
SELECT * FROM t1
|
||||
WHERE ROW(one,two) IN (SELECT DISTINCT one,two FROM t1 WHERE flag = 'N');
|
||||
one two flag
|
||||
5 6 N
|
||||
7 8 N
|
||||
DROP TABLE t1,t2;
|
||||
create table t1 (df decimal(5,1));
|
||||
insert into t1 values(1.1);
|
||||
insert into t1 values(2.2);
|
||||
|
@ -70,4 +70,35 @@ insert into t1 values (345);
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#9459 - deadlock with flush with lock, and lock table write
|
||||
#
|
||||
create table t1 (c1 int);
|
||||
lock table t1 write;
|
||||
# Cannot get the global read lock with write locked tables.
|
||||
--error 1192
|
||||
flush tables with read lock;
|
||||
lock table t1 read;
|
||||
# Can get the global read lock with read locked tables.
|
||||
flush tables with read lock;
|
||||
--error 1223
|
||||
lock table t1 write;
|
||||
lock table t1 read;
|
||||
--error 1223
|
||||
lock table t1 write;
|
||||
# Release all table locks and the global read lock.
|
||||
unlock tables;
|
||||
create table t2 (c1 int);
|
||||
create table t3 (c1 int);
|
||||
lock table t1 read, t2 read, t3 write;
|
||||
# Cannot get the global read lock with write locked tables.
|
||||
--error 1192
|
||||
flush tables with read lock;
|
||||
lock table t1 read, t2 read, t3 read;
|
||||
# Can get the global read lock with read locked tables.
|
||||
flush tables with read lock;
|
||||
# Release all table locks and the global read lock.
|
||||
unlock tables;
|
||||
drop table t1, t2, t3;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
@ -1,5 +1,5 @@
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t1,t2,t3;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (
|
||||
@ -117,8 +117,6 @@ where
|
||||
order by
|
||||
match(b.betreff) against ('+abc' in boolean mode) desc;
|
||||
|
||||
-- todo psergey: fix
|
||||
--error 1214
|
||||
select a.text, b.id, b.betreff
|
||||
from
|
||||
t2 a inner join t3 b on a.id = b.forum inner join
|
||||
@ -135,6 +133,22 @@ where
|
||||
order by
|
||||
match(betreff) against ('+abc' in boolean mode) desc;
|
||||
|
||||
# BUG#11869 part2: used table type doesn't support FULLTEXT indexes error
|
||||
(select b.id, b.betreff from t3 b) union
|
||||
(select b.id, b.betreff from t3 b)
|
||||
order by match(betreff) against ('+abc' in boolean mode) desc;
|
||||
|
||||
--error 1191
|
||||
(select b.id, b.betreff from t3 b) union
|
||||
(select b.id, b.betreff from t3 b)
|
||||
order by match(betreff) against ('+abc') desc;
|
||||
|
||||
select distinct b.id, b.betreff from t3 b
|
||||
order by match(betreff) against ('+abc' in boolean mode) desc;
|
||||
|
||||
select b.id, b.betreff from t3 b group by b.id+1
|
||||
order by match(betreff) against ('+abc' in boolean mode) desc;
|
||||
|
||||
drop table t1,t2,t3;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
@ -480,4 +480,11 @@ flush privileges;
|
||||
delete from tables_priv where host = '' and user = 'mysqltest_1';
|
||||
flush privileges;
|
||||
|
||||
#
|
||||
# Bug #10892 user variables not auto cast for comparisons
|
||||
# Check that we don't get illegal mix of collations
|
||||
#
|
||||
set @user123="non-existent";
|
||||
select * from mysql.db where user=@user123;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
@ -575,12 +575,22 @@ CREATE TABLE t1 (id varchar(20) NOT NULL);
|
||||
INSERT INTO t1 VALUES ('trans1'), ('trans2');
|
||||
CREATE TABLE t2 (id varchar(20) NOT NULL, err_comment blob NOT NULL);
|
||||
INSERT INTO t2 VALUES ('trans1', 'a problem');
|
||||
|
||||
SELECT COUNT(DISTINCT(t1.id)), LEFT(err_comment, 256) AS comment
|
||||
FROM t1 LEFT JOIN t2 ON t1.id=t2.id GROUP BY comment;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
|
||||
#
|
||||
# Bug #12266 GROUP BY expression on DATE column produces result with
|
||||
# reduced length
|
||||
#
|
||||
create table t1 (f1 date);
|
||||
insert into t1 values('2005-06-06');
|
||||
insert into t1 values('2005-06-06');
|
||||
select date(left(f1+0,8)) from t1 group by 1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test for bug #11414: crash on Windows for a simple GROUP BY query
|
||||
#
|
||||
|
@ -770,3 +770,51 @@ SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21;
|
||||
EXPLAIN SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21;
|
||||
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
||||
#
|
||||
# Bug #12154: creation of temp table for a query with nested outer join
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (goods int(12) NOT NULL, price varchar(128) NOT NULL);
|
||||
INSERT INTO t1 VALUES (23, 2340), (26, 9900);
|
||||
|
||||
CREATE TABLE t2 (goods int(12), name varchar(50), shop char(2));
|
||||
INSERT INTO t2 VALUES (23, 'as300', 'fr'), (26, 'as600', 'fr');
|
||||
|
||||
create table t3 (groupid int(12) NOT NULL, goodsid int(12) NOT NULL);
|
||||
INSERT INTO t3 VALUES (3,23), (6,26);
|
||||
|
||||
CREATE TABLE t4 (groupid int(12));
|
||||
INSERT INTO t4 VALUES (1), (2), (3), (4), (5), (6);
|
||||
|
||||
SELECT * FROM
|
||||
(SELECT DISTINCT gl.groupid, gp.price
|
||||
FROM t4 gl
|
||||
LEFT JOIN
|
||||
(t3 g INNER JOIN t2 p ON g.goodsid = p.goods
|
||||
INNER JOIN t1 gp ON p.goods = gp.goods)
|
||||
ON gl.groupid = g.groupid and p.shop = 'fr') t;
|
||||
|
||||
CREATE VIEW v1 AS
|
||||
SELECT g.groupid groupid, p.goods goods,
|
||||
p.name name, p.shop shop,
|
||||
gp.price price
|
||||
FROM t3 g INNER JOIN t2 p ON g.goodsid = p.goods
|
||||
INNER JOIN t1 gp on p.goods = gp.goods;
|
||||
|
||||
CREATE VIEW v2 AS
|
||||
SELECT DISTINCT g.groupid, fr.price
|
||||
FROM t4 g
|
||||
LEFT JOIN
|
||||
v1 fr on g.groupid = fr.groupid and fr.shop = 'fr';
|
||||
|
||||
SELECT * FROM v2;
|
||||
|
||||
SELECT * FROM
|
||||
(SELECT DISTINCT g.groupid, fr.price
|
||||
FROM t4 g
|
||||
LEFT JOIN
|
||||
v1 fr on g.groupid = fr.groupid and fr.shop = 'fr') t;
|
||||
|
||||
DROP VIEW v1,v2;
|
||||
DROP TABLE t1,t2,t3,t4;
|
||||
|
@ -168,4 +168,11 @@ check table t1;
|
||||
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#10473 - Can't set 'key_buffer_size' system variable to ZERO
|
||||
# (One cannot drop the default key cache.)
|
||||
#
|
||||
set @@global.key_buffer_size=0;
|
||||
select @@global.key_buffer_size;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
@ -1726,8 +1726,57 @@ select (select a from t1) = (1,2);
|
||||
select (1,2,3) = (select * from t1);
|
||||
-- error 1241
|
||||
select (select * from t1) = (1,2,3);
|
||||
drop table t1
|
||||
|
||||
#
|
||||
# Item_int_with_ref check (BUG#10020)
|
||||
#
|
||||
CREATE TABLE `t1` (
|
||||
`itemid` bigint(20) unsigned NOT NULL auto_increment,
|
||||
`sessionid` bigint(20) unsigned default NULL,
|
||||
`time` int(10) unsigned NOT NULL default '0',
|
||||
`type` set('A','D','E','F','G','I','L','N','U') collate latin1_general_ci NOT
|
||||
NULL default '',
|
||||
`data` text collate latin1_general_ci NOT NULL,
|
||||
PRIMARY KEY (`itemid`)
|
||||
) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
|
||||
INSERT INTO `t1` VALUES (1, 1, 1, 'D', '');
|
||||
CREATE TABLE `t2` (
|
||||
`sessionid` bigint(20) unsigned NOT NULL auto_increment,
|
||||
`pid` int(10) unsigned NOT NULL default '0',
|
||||
`date` int(10) unsigned NOT NULL default '0',
|
||||
`ip` varchar(15) collate latin1_general_ci NOT NULL default '',
|
||||
PRIMARY KEY (`sessionid`)
|
||||
) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
|
||||
INSERT INTO `t2` VALUES (1, 1, 1, '10.10.10.1');
|
||||
SELECT s.ip, count( e.itemid ) FROM `t1` e JOIN t2 s ON s.sessionid = e.sessionid WHERE e.sessionid = ( SELECT sessionid FROM t2 ORDER BY sessionid DESC LIMIT 1 ) GROUP BY s.ip HAVING count( e.itemid ) >0 LIMIT 0 , 30;
|
||||
drop tables t1,t2;
|
||||
|
||||
# BUG#11821 : Select from subselect using aggregate function on an enum
|
||||
# segfaults:
|
||||
create table t1 (fld enum('0','1'));
|
||||
insert into t1 values ('1');
|
||||
select * from (select max(fld) from t1) as foo;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #11867: queries with ROW(,elems>) IN (SELECT DISTINCT <cols> FROM ...)
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (one int, two int, flag char(1));
|
||||
CREATE TABLE t2 (one int, two int, flag char(1));
|
||||
INSERT INTO t1 VALUES(1,2,'Y'),(2,3,'Y'),(3,4,'Y'),(5,6,'N'),(7,8,'N');
|
||||
INSERT INTO t2 VALUES(1,2,'Y'),(2,3,'Y'),(3,4,'Y'),(5,6,'N'),(7,8,'N');
|
||||
|
||||
SELECT * FROM t1
|
||||
WHERE ROW(one,two) IN (SELECT DISTINCT one,two FROM t2 WHERE flag = 'N');
|
||||
SELECT * FROM t1
|
||||
WHERE ROW(one,two) IN (SELECT DISTINCT one,two FROM t1 WHERE flag = 'N');
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
#decimal-related tests
|
||||
#
|
||||
@ -1868,4 +1917,3 @@ select * from (select max(fld) from t1) as foo;
|
||||
drop table t1;
|
||||
|
||||
|
||||
# End of 4.1 tests
|
||||
|
Reference in New Issue
Block a user