1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

5.3 merge

This commit is contained in:
Sergei Golubchik
2012-10-18 23:33:06 +02:00
40 changed files with 1130 additions and 162 deletions

View File

@ -136,9 +136,13 @@ void CleanUp();
// Turn on ia32 ASM for Big Integer // Turn on ia32 ASM for Big Integer
// CodeWarrior defines _MSC_VER // CodeWarrior defines _MSC_VER
//
// Do not use assembler with GCC, as the implementation for it is broken;
// it does not use proper GCC asm contraints and makes assumptions about
// frame pointers and so on, which breaks depending on GCC version and
// optimization level.
#if !defined(TAOCRYPT_DISABLE_X86ASM) && ((defined(_MSC_VER) && \ #if !defined(TAOCRYPT_DISABLE_X86ASM) && ((defined(_MSC_VER) && \
!defined(__MWERKS__) && defined(_M_IX86)) || \ !defined(__MWERKS__) && defined(_M_IX86)))
(defined(__GNUC__) && defined(__i386__)))
#define TAOCRYPT_X86ASM_AVAILABLE #define TAOCRYPT_X86ASM_AVAILABLE
#endif #endif

View File

@ -1687,6 +1687,7 @@ SELECT t.b, t.c, t1.a
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
WHERE t.b AND t.c = t1.a; WHERE t.b AND t.c = t1.a;
b c a b c a
8 c c
EXPLAIN EXTENDED EXPLAIN EXTENDED
SELECT t.b, t.c, t1.a SELECT t.b, t.c, t1.a
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
@ -1701,6 +1702,7 @@ SELECT t.b, t.c, t1.a
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
WHERE t.b <> 0 AND t.c = t1.a; WHERE t.b <> 0 AND t.c = t1.a;
b c a b c a
8 c c
INSERT INTO t3 VALUES (100), (200); INSERT INTO t3 VALUES (100), (200);
EXPLAIN EXTENDED EXPLAIN EXTENDED
SELECT t.b, t.c, t1.a SELECT t.b, t.c, t1.a
@ -1716,7 +1718,7 @@ SELECT t.b, t.c, t1.a
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
WHERE t.b AND t.c = t1.a; WHERE t.b AND t.c = t1.a;
b c a b c a
NULL NULL c 8 c c
EXPLAIN EXTENDED EXPLAIN EXTENDED
SELECT t.b, t.c, t1.a SELECT t.b, t.c, t1.a
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
@ -1731,7 +1733,7 @@ SELECT t.b, t.c, t1.a
FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
WHERE t.b <> 0 AND t.c = t1.a; WHERE t.b <> 0 AND t.c = t1.a;
b c a b c a
NULL NULL c 8 c c
SET optimizer_switch=@save_optimizer_switch; SET optimizer_switch=@save_optimizer_switch;
DROP TABLE t1,t2,t3; DROP TABLE t1,t2,t3;
# #

View File

@ -5589,4 +5589,52 @@ set join_buffer_size=default;
set join_cache_level=default; set join_cache_level=default;
set optimizer_switch=@tmp_optimizer_switch; set optimizer_switch=@tmp_optimizer_switch;
DROP TABLE t1,t2,t3; DROP TABLE t1,t2,t3;
#
# Bug #1058071: LEFT JOIN using blobs
# (mdev-564) when join buffer size is small
#
CREATE TABLE t1 (
col269 decimal(31,10) unsigned DEFAULT NULL,
col280 multipoint DEFAULT NULL,
col281 tinyint(1) DEFAULT NULL,
col282 time NOT NULL,
col284 datetime DEFAULT NULL,
col286 date DEFAULT NULL,
col287 datetime DEFAULT NULL,
col288 decimal(30,29) DEFAULT NULL,
col291 time DEFAULT NULL,
col292 time DEFAULT NULL
) ENGINE=Aria;
INSERT INTO t1 VALUES
(0.0,PointFromText('POINT(9 0)'),0,'11:24:05','2013-04-14 21:30:28',NULL,'2011-12-20 06:00:34',9.9,'13:04:39',NULL),
(0.0,NULL,127,'05:43:12','2012-09-05 06:15:27','2027-01-01','2011-10-29 10:48:29',0.0,'06:24:05','11:33:37'),
(0.0,NULL,127,'12:54:41','2013-01-12 11:32:58','2011-11-03','2013-01-03 02:00:34',00,'11:54:15','20:19:15'),
(0.0,PointFromText('POINT(9 0)'),0,'19:48:07','2012-07-16 15:45:25','2012-03-25','2013-09-07 17:21:52',0.5,'17:36:54','21:24:19'),
(0.0,PointFromText('POINT(9 0)'),0,'03:43:48','2012-09-28 00:00:00','2012-06-26','2011-11-16 05:01:09',00,'01:25:42','19:30:06'),
(0.0,LineStringFromText('LINESTRING(0 0,9 9,0 0,9 0,0 0)'),127,'11:33:21','2012-03-31 10:29:22','2012-10-10','2012-04-21 19:21:06',NULL,'05:13:22','09:48:34'),
(NULL,PointFromText('POINT(9 0)'),127,'00:00:00','0000-00-00','2012-04-04 21:26:12','2013-03-04',0.0,'12:54:30',NULL),
(NULL,PointFromText('POINT(9 0)'),1,'00:00:00','2013-05-01 22:37:49','2013-06-26','2012-09-22 17:31:03',0.0,'08:09:57','11:15:36');
Warnings:
Note 1265 Data truncated for column 'col286' at row 7
CREATE TABLE t2 (b int) ENGINE=Aria;
INSERT INTO t2 VALUES (NULL);
CREATE TABLE t3 (c int) ENGINE=Aria;
INSERT INTO t3 VALUES (NULL);
set @tmp_optimizer_switch=@@optimizer_switch;
set optimizer_switch = 'outer_join_with_cache=on,join_cache_incremental=on';
set join_buffer_size=128;
EXPLAIN
SELECT 1 AS c FROM t1 NATURAL LEFT JOIN t2 LEFT OUTER JOIN t3 ON 1
GROUP BY elt(t1.col282,1,t1.col280);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using temporary; Using filesort
1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t3 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
SELECT 1 AS c FROM t1 NATURAL LEFT JOIN t2 LEFT OUTER JOIN t3 ON 1
GROUP BY elt(t1.col282,1,t1.col280);
c
1
set join_buffer_size=default;
set optimizer_switch=@tmp_optimizer_switch;
DROP table t1,t2,t3;
set @@optimizer_switch=@save_optimizer_switch; set @@optimizer_switch=@save_optimizer_switch;

View File

@ -204,6 +204,10 @@ The following options may be given as the first argument:
-?, --help Display this help and exit. -?, --help Display this help and exit.
--ignore-builtin-innodb --ignore-builtin-innodb
Disable initialization of builtin InnoDB plugin Disable initialization of builtin InnoDB plugin
--ignore-db-dirs=name
Specifies a directory to add to the ignore list when
collecting database names from the datadir. Put a blank
argument to reset the list accumulated so far.
--init-connect=name Command(s) that are executed for each new connection --init-connect=name Command(s) that are executed for each new connection
(unless the user has SUPER privilege) (unless the user has SUPER privilege)
--init-file=name Read SQL commands from this file at startup --init-file=name Read SQL commands from this file at startup
@ -909,6 +913,7 @@ general-log FALSE
group-concat-max-len 1024 group-concat-max-len 1024
help TRUE help TRUE
ignore-builtin-innodb FALSE ignore-builtin-innodb FALSE
ignore-db-dirs
init-connect init-connect
init-file (No default value) init-file (No default value)
init-rpl-role MASTER init-rpl-role MASTER

View File

@ -4887,7 +4887,7 @@ CREATE TABLE t5 (f1 int) ;
INSERT INTO t5 VALUES (20),(5); INSERT INTO t5 VALUES (20),(5);
CREATE TABLE t6(f1 int); CREATE TABLE t6(f1 int);
INSERT INTO t6 VALUES (9),(7); INSERT INTO t6 VALUES (9),(7);
SET SESSION join_buffer_size = 2048; SET SESSION join_buffer_size = 2176;
EXPLAIN EXPLAIN
SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6; SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
@ -4901,50 +4901,50 @@ SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
f1 f1 f1 f1 f2 f1 f1 f1 f1 f1 f1 f2 f1 f1
3 9 NULL NULL NULL 20 9 3 9 NULL NULL NULL 20 9
7 9 NULL NULL NULL 20 9 7 9 NULL NULL NULL 20 9
3 9 NULL NULL NULL 20 7
7 9 NULL NULL NULL 20 7
3 9 NULL NULL NULL 5 9
7 9 NULL NULL NULL 5 9
3 9 NULL NULL NULL 5 7
7 9 NULL NULL NULL 5 7
18 9 NULL NULL NULL 20 9 18 9 NULL NULL NULL 20 9
3 9 NULL NULL NULL 20 9 3 9 NULL NULL NULL 20 9
18 9 NULL NULL NULL 20 7
3 9 NULL NULL NULL 20 7
18 9 NULL NULL NULL 5 9
3 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 5 7
3 9 NULL NULL NULL 5 7
7 9 NULL NULL NULL 20 9
18 9 NULL NULL NULL 20 9
7 9 NULL NULL NULL 20 7
18 9 NULL NULL NULL 20 7
7 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 5 9
7 9 NULL NULL NULL 5 7
18 9 NULL NULL NULL 5 7
3 9 NULL NULL NULL 20 9
7 9 NULL NULL NULL 20 9 7 9 NULL NULL NULL 20 9
3 9 NULL NULL NULL 20 7 3 9 NULL NULL NULL 20 7
7 9 NULL NULL NULL 20 7 7 9 NULL NULL NULL 20 7
3 9 NULL NULL NULL 5 9
7 9 NULL NULL NULL 5 9
3 9 NULL NULL NULL 5 7
7 9 NULL NULL NULL 5 7
18 9 NULL NULL NULL 20 9
3 9 NULL NULL NULL 20 9
18 9 NULL NULL NULL 20 7 18 9 NULL NULL NULL 20 7
3 9 NULL NULL NULL 20 7 3 9 NULL NULL NULL 20 7
18 9 NULL NULL NULL 5 9
3 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 5 7
3 9 NULL NULL NULL 5 7
7 9 NULL NULL NULL 20 9
18 9 NULL NULL NULL 20 9
7 9 NULL NULL NULL 20 7 7 9 NULL NULL NULL 20 7
18 9 NULL NULL NULL 20 7 18 9 NULL NULL NULL 20 9
3 9 NULL NULL NULL 20 9
3 9 NULL NULL NULL 5 9
7 9 NULL NULL NULL 5 9 7 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 5 9 18 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 20 7
3 9 NULL NULL NULL 20 7
3 9 NULL NULL NULL 5 7
7 9 NULL NULL NULL 5 7
18 9 NULL NULL NULL 5 7
3 9 NULL NULL NULL 5 9
7 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 5 9
3 9 NULL NULL NULL 5 9
7 9 NULL NULL NULL 20 9
3 9 NULL NULL NULL 5 7
7 9 NULL NULL NULL 5 7
18 9 NULL NULL NULL 5 7
3 9 NULL NULL NULL 5 7
7 9 NULL NULL NULL 20 7
18 9 NULL NULL NULL 20 9
3 9 NULL NULL NULL 20 9
7 9 NULL NULL NULL 20 9
18 9 NULL NULL NULL 20 9
7 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 20 7
3 9 NULL NULL NULL 20 7
7 9 NULL NULL NULL 20 7
18 9 NULL NULL NULL 20 7
7 9 NULL NULL NULL 5 7
18 9 NULL NULL NULL 5 9
3 9 NULL NULL NULL 5 9
7 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 5 7
3 9 NULL NULL NULL 5 7
7 9 NULL NULL NULL 5 7 7 9 NULL NULL NULL 5 7
18 9 NULL NULL NULL 5 7 18 9 NULL NULL NULL 5 7
SET SESSION join_buffer_size = DEFAULT; SET SESSION join_buffer_size = DEFAULT;

View File

@ -4898,7 +4898,7 @@ CREATE TABLE t5 (f1 int) ;
INSERT INTO t5 VALUES (20),(5); INSERT INTO t5 VALUES (20),(5);
CREATE TABLE t6(f1 int); CREATE TABLE t6(f1 int);
INSERT INTO t6 VALUES (9),(7); INSERT INTO t6 VALUES (9),(7);
SET SESSION join_buffer_size = 2048; SET SESSION join_buffer_size = 2176;
EXPLAIN EXPLAIN
SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6; SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
@ -4913,48 +4913,48 @@ f1 f1 f1 f1 f2 f1 f1
3 9 NULL NULL NULL 20 9 3 9 NULL NULL NULL 20 9
7 9 NULL NULL NULL 20 9 7 9 NULL NULL NULL 20 9
18 9 NULL NULL NULL 20 9 18 9 NULL NULL NULL 20 9
3 9 NULL NULL NULL 5 9 3 9 NULL NULL NULL 20 9
7 9 NULL NULL NULL 5 9 7 9 NULL NULL NULL 20 9
18 9 NULL NULL NULL 5 9 18 9 NULL NULL NULL 20 9
3 9 NULL NULL NULL 20 7 3 9 NULL NULL NULL 20 9
7 9 NULL NULL NULL 20 7 7 9 NULL NULL NULL 20 9
18 9 NULL NULL NULL 20 7 18 9 NULL NULL NULL 20 9
3 9 NULL NULL NULL 5 7
7 9 NULL NULL NULL 5 7
18 9 NULL NULL NULL 5 7
3 9 NULL NULL NULL 20 9 3 9 NULL NULL NULL 20 9
7 9 NULL NULL NULL 20 9 7 9 NULL NULL NULL 20 9
18 9 NULL NULL NULL 20 9 18 9 NULL NULL NULL 20 9
3 9 NULL NULL NULL 5 9 3 9 NULL NULL NULL 5 9
7 9 NULL NULL NULL 5 9 7 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 5 9 18 9 NULL NULL NULL 5 9
3 9 NULL NULL NULL 20 7 3 9 NULL NULL NULL 5 9
7 9 NULL NULL NULL 20 7 7 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 20 7 18 9 NULL NULL NULL 5 9
3 9 NULL NULL NULL 5 7 3 9 NULL NULL NULL 5 9
7 9 NULL NULL NULL 5 7 7 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 5 7 18 9 NULL NULL NULL 5 9
3 9 NULL NULL NULL 20 9
7 9 NULL NULL NULL 20 9
18 9 NULL NULL NULL 20 9
3 9 NULL NULL NULL 5 9 3 9 NULL NULL NULL 5 9
7 9 NULL NULL NULL 5 9 7 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 5 9 18 9 NULL NULL NULL 5 9
3 9 NULL NULL NULL 20 7 3 9 NULL NULL NULL 20 7
7 9 NULL NULL NULL 20 7 7 9 NULL NULL NULL 20 7
18 9 NULL NULL NULL 20 7 18 9 NULL NULL NULL 20 7
3 9 NULL NULL NULL 5 7
7 9 NULL NULL NULL 5 7
18 9 NULL NULL NULL 5 7
3 9 NULL NULL NULL 20 9
7 9 NULL NULL NULL 20 9
18 9 NULL NULL NULL 20 9
3 9 NULL NULL NULL 5 9
7 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 5 9
3 9 NULL NULL NULL 20 7 3 9 NULL NULL NULL 20 7
7 9 NULL NULL NULL 20 7 7 9 NULL NULL NULL 20 7
18 9 NULL NULL NULL 20 7 18 9 NULL NULL NULL 20 7
3 9 NULL NULL NULL 20 7
7 9 NULL NULL NULL 20 7
18 9 NULL NULL NULL 20 7
3 9 NULL NULL NULL 20 7
7 9 NULL NULL NULL 20 7
18 9 NULL NULL NULL 20 7
3 9 NULL NULL NULL 5 7
7 9 NULL NULL NULL 5 7
18 9 NULL NULL NULL 5 7
3 9 NULL NULL NULL 5 7
7 9 NULL NULL NULL 5 7
18 9 NULL NULL NULL 5 7
3 9 NULL NULL NULL 5 7
7 9 NULL NULL NULL 5 7
18 9 NULL NULL NULL 5 7
3 9 NULL NULL NULL 5 7 3 9 NULL NULL NULL 5 7
7 9 NULL NULL NULL 5 7 7 9 NULL NULL NULL 5 7
18 9 NULL NULL NULL 5 7 18 9 NULL NULL NULL 5 7

View File

@ -4887,7 +4887,7 @@ CREATE TABLE t5 (f1 int) ;
INSERT INTO t5 VALUES (20),(5); INSERT INTO t5 VALUES (20),(5);
CREATE TABLE t6(f1 int); CREATE TABLE t6(f1 int);
INSERT INTO t6 VALUES (9),(7); INSERT INTO t6 VALUES (9),(7);
SET SESSION join_buffer_size = 2048; SET SESSION join_buffer_size = 2176;
EXPLAIN EXPLAIN
SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6; SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
@ -4901,50 +4901,50 @@ SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
f1 f1 f1 f1 f2 f1 f1 f1 f1 f1 f1 f2 f1 f1
3 9 NULL NULL NULL 20 9 3 9 NULL NULL NULL 20 9
7 9 NULL NULL NULL 20 9 7 9 NULL NULL NULL 20 9
3 9 NULL NULL NULL 20 7
7 9 NULL NULL NULL 20 7
3 9 NULL NULL NULL 5 9
7 9 NULL NULL NULL 5 9
3 9 NULL NULL NULL 5 7
7 9 NULL NULL NULL 5 7
18 9 NULL NULL NULL 20 9 18 9 NULL NULL NULL 20 9
3 9 NULL NULL NULL 20 9 3 9 NULL NULL NULL 20 9
18 9 NULL NULL NULL 20 7
3 9 NULL NULL NULL 20 7
18 9 NULL NULL NULL 5 9
3 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 5 7
3 9 NULL NULL NULL 5 7
7 9 NULL NULL NULL 20 9
18 9 NULL NULL NULL 20 9
7 9 NULL NULL NULL 20 7
18 9 NULL NULL NULL 20 7
7 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 5 9
7 9 NULL NULL NULL 5 7
18 9 NULL NULL NULL 5 7
3 9 NULL NULL NULL 20 9
7 9 NULL NULL NULL 20 9 7 9 NULL NULL NULL 20 9
3 9 NULL NULL NULL 20 7 3 9 NULL NULL NULL 20 7
7 9 NULL NULL NULL 20 7 7 9 NULL NULL NULL 20 7
3 9 NULL NULL NULL 5 9
7 9 NULL NULL NULL 5 9
3 9 NULL NULL NULL 5 7
7 9 NULL NULL NULL 5 7
18 9 NULL NULL NULL 20 9
3 9 NULL NULL NULL 20 9
18 9 NULL NULL NULL 20 7 18 9 NULL NULL NULL 20 7
3 9 NULL NULL NULL 20 7 3 9 NULL NULL NULL 20 7
18 9 NULL NULL NULL 5 9
3 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 5 7
3 9 NULL NULL NULL 5 7
7 9 NULL NULL NULL 20 9
18 9 NULL NULL NULL 20 9
7 9 NULL NULL NULL 20 7 7 9 NULL NULL NULL 20 7
18 9 NULL NULL NULL 20 7 18 9 NULL NULL NULL 20 9
3 9 NULL NULL NULL 20 9
3 9 NULL NULL NULL 5 9
7 9 NULL NULL NULL 5 9 7 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 5 9 18 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 20 7
3 9 NULL NULL NULL 20 7
3 9 NULL NULL NULL 5 7
7 9 NULL NULL NULL 5 7
18 9 NULL NULL NULL 5 7
3 9 NULL NULL NULL 5 9
7 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 5 9
3 9 NULL NULL NULL 5 9
7 9 NULL NULL NULL 20 9
3 9 NULL NULL NULL 5 7
7 9 NULL NULL NULL 5 7
18 9 NULL NULL NULL 5 7
3 9 NULL NULL NULL 5 7
7 9 NULL NULL NULL 20 7
18 9 NULL NULL NULL 20 9
3 9 NULL NULL NULL 20 9
7 9 NULL NULL NULL 20 9
18 9 NULL NULL NULL 20 9
7 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 20 7
3 9 NULL NULL NULL 20 7
7 9 NULL NULL NULL 20 7
18 9 NULL NULL NULL 20 7
7 9 NULL NULL NULL 5 7
18 9 NULL NULL NULL 5 9
3 9 NULL NULL NULL 5 9
7 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 5 9
18 9 NULL NULL NULL 5 7
3 9 NULL NULL NULL 5 7
7 9 NULL NULL NULL 5 7 7 9 NULL NULL NULL 5 7
18 9 NULL NULL NULL 5 7 18 9 NULL NULL NULL 5 7
SET SESSION join_buffer_size = DEFAULT; SET SESSION join_buffer_size = DEFAULT;

View File

@ -6638,6 +6638,23 @@ a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
set optimizer_switch=@mdev367_optimizer_switch; set optimizer_switch=@mdev367_optimizer_switch;
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-521 single value subselect transformation problem
#
CREATE TABLE t1 (f1 char(2), PRIMARY KEY (f1)) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('u1'),('u2');
SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) );
f1
u1
u2
FLUSH TABLES;
SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) );
f1
u1
u2
DROP TABLE t1;
# return optimizer switch changed in the beginning of this test
set optimizer_switch=@subselect_tmp;
#
# lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not # lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not
# precomputed and thus not part of optimization # precomputed and thus not part of optimization
# #

View File

@ -179,4 +179,23 @@ pk a b
SET optimizer_switch=@tmp_optimizer_switch; SET optimizer_switch=@tmp_optimizer_switch;
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1,t2,t3; DROP TABLE t1,t2,t3;
#
# MDEV-567: Wrong result from a query with correlated subquery if ICP is allowed
#
CREATE TABLE t1 (a int, b int, INDEX idx(a));
INSERT INTO t1 VALUES (9,0), (7,1), (1,9), (7,3), (2,1);
CREATE TABLE t2 (a int, b int, INDEX idx(a));
INSERT INTO t2 VALUES (2,1), (6,4), (7,6), (9,4);
CREATE TABLE t3 (a int, b int);
INSERT INTO t3 VALUES (1,0), (1,1), (1,3);
SELECT * FROM t3
WHERE a = (SELECT COUNT(DISTINCT t2.b) FROM t1, t2
WHERE t1.a = t2.a AND t2.a BETWEEN 7 AND 9
AND t3.b = t1.b
GROUP BY t1.b);
a b
1 0
1 1
1 3
DROP TABLE t1, t2, t3;
set optimizer_switch=@subselect2_test_tmp; set optimizer_switch=@subselect2_test_tmp;

View File

@ -6637,6 +6637,23 @@ a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
set optimizer_switch=@mdev367_optimizer_switch; set optimizer_switch=@mdev367_optimizer_switch;
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-521 single value subselect transformation problem
#
CREATE TABLE t1 (f1 char(2), PRIMARY KEY (f1)) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('u1'),('u2');
SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) );
f1
u1
u2
FLUSH TABLES;
SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) );
f1
u1
u2
DROP TABLE t1;
# return optimizer switch changed in the beginning of this test
set optimizer_switch=@subselect_tmp;
#
# lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not # lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not
# precomputed and thus not part of optimization # precomputed and thus not part of optimization
# #

View File

@ -6633,6 +6633,23 @@ a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
set optimizer_switch=@mdev367_optimizer_switch; set optimizer_switch=@mdev367_optimizer_switch;
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-521 single value subselect transformation problem
#
CREATE TABLE t1 (f1 char(2), PRIMARY KEY (f1)) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('u1'),('u2');
SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) );
f1
u1
u2
FLUSH TABLES;
SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) );
f1
u1
u2
DROP TABLE t1;
# return optimizer switch changed in the beginning of this test
set optimizer_switch=@subselect_tmp;
#
# lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not # lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not
# precomputed and thus not part of optimization # precomputed and thus not part of optimization
# #

View File

@ -6644,6 +6644,23 @@ a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
set optimizer_switch=@mdev367_optimizer_switch; set optimizer_switch=@mdev367_optimizer_switch;
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-521 single value subselect transformation problem
#
CREATE TABLE t1 (f1 char(2), PRIMARY KEY (f1)) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('u1'),('u2');
SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) );
f1
u1
u2
FLUSH TABLES;
SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) );
f1
u1
u2
DROP TABLE t1;
# return optimizer switch changed in the beginning of this test
set optimizer_switch=@subselect_tmp;
#
# lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not # lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not
# precomputed and thus not part of optimization # precomputed and thus not part of optimization
# #

View File

@ -6633,6 +6633,23 @@ a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
set optimizer_switch=@mdev367_optimizer_switch; set optimizer_switch=@mdev367_optimizer_switch;
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-521 single value subselect transformation problem
#
CREATE TABLE t1 (f1 char(2), PRIMARY KEY (f1)) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('u1'),('u2');
SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) );
f1
u1
u2
FLUSH TABLES;
SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) );
f1
u1
u2
DROP TABLE t1;
# return optimizer switch changed in the beginning of this test
set optimizer_switch=@subselect_tmp;
#
# lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not # lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not
# precomputed and thus not part of optimization # precomputed and thus not part of optimization
# #

View File

@ -4530,6 +4530,55 @@ WHERE t4.a >= v1.a);
a a a a
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1,t2,t3,t4; DROP TABLE t1,t2,t3,t4;
#
# LP bug #823237: dependent subquery with LEFT JOIN
# referencing view in WHERE
# (duplicate of LP bug #823189)
#
CREATE TABLE t1 (a int);
CREATE TABLE t2 ( b int, d int, e int);
INSERT INTO t2 VALUES (7,8,0);
CREATE TABLE t3 ( c int);
INSERT INTO t3 VALUES (0);
CREATE TABLE t4 (a int, b int, c int);
INSERT INTO t4 VALUES (93,1,0), (95,NULL,0);
CREATE VIEW v4 AS SELECT * FROM t4;
EXPLAIN EXTENDED
SELECT * FROM t3 , t4
WHERE t4.c <= (SELECT t2.e FROM t2 LEFT JOIN t1 ON ( t1.a = t2.d )
WHERE t2.b > t4.b);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 system NULL NULL NULL NULL 1 100.00
1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 Using where
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 100.00
2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
Note 1276 Field or reference 'test.t4.b' of SELECT #2 was resolved in SELECT #1
Note 1003 select 0 AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c` from `test`.`t4` where (`test`.`t4`.`c` <= <expr_cache><`test`.`t4`.`b`>((select 0 from dual where (7 > `test`.`t4`.`b`))))
SELECT * FROM t3 , t4
WHERE t4.c <= (SELECT t2.e FROM t2 LEFT JOIN t1 ON ( t1.a = t2.d )
WHERE t2.b > t4.b);
c a b c
0 93 1 0
EXPLAIN EXTENDED
SELECT * FROM t3, v4
WHERE v4.c <= (SELECT t2.e FROM t2 LEFT JOIN t1 ON ( t1.a = t2.d )
WHERE t2.b > v4.b);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 system NULL NULL NULL NULL 1 100.00
1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 Using where
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1 100.00
2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
Warnings:
Note 1276 Field or reference 'v4.b' of SELECT #2 was resolved in SELECT #1
Note 1003 select 0 AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c` from `test`.`t4` where (`test`.`t4`.`c` <= <expr_cache><`test`.`t4`.`b`>((select 0 from dual where (7 > `test`.`t4`.`b`))))
SELECT * FROM t3, v4
WHERE v4.c <= (SELECT t2.e FROM t2 LEFT JOIN t1 ON ( t1.a = t2.d )
WHERE t2.b > v4.b);
c a b c
0 93 1 0
DROP VIEW v4;
DROP TABLE t1,t2,t3,t4;
drop table if exists t_9801; drop table if exists t_9801;
drop view if exists v_9801; drop view if exists v_9801;
create table t_9801 (s1 int); create table t_9801 (s1 int);
@ -4730,6 +4779,49 @@ id id bbb iddqd val1
30631 NULL NULL NULL NULL 30631 NULL NULL NULL NULL
drop view v2; drop view v2;
drop table t1,t2; drop table t1,t2;
#
# MDEV-589 (LP BUG#1007647) :
# Assertion `vcol_table == 0 || vcol_table == table' failed in
# fill_record(THD*, List<Item>&, List<Item>&, bool)
#
CREATE TABLE t1 (f1 INT, f2 INT);
CREATE TABLE t2 (f1 INT, f2 INT);
CREATE ALGORITHM=MERGE VIEW v1 AS SELECT a1.f1, a2.f2 FROM t1 AS a1, t1 AS a2;
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM v1;
CREATE ALGORITHM=MERGE VIEW v3 AS SELECT a1.f1, a2.f2 FROM t1 AS a1, t2 AS a2;
CREATE ALGORITHM=MERGE VIEW v4 AS SELECT * FROM v3;
INSERT INTO v3 (f1, f2) VALUES (1, 2);
ERROR HY000: Can not modify more than one base table through a join view 'test.v3'
INSERT INTO v1 (f1, f2) VALUES (1, 2);
ERROR HY000: Can not modify more than one base table through a join view 'test.v1'
INSERT INTO v4 (f1, f2) VALUES (1, 2);
ERROR HY000: Can not modify more than one base table through a join view 'test.v4'
INSERT INTO v2 (f1, f2) VALUES (1, 2);
ERROR HY000: Can not modify more than one base table through a join view 'test.v2'
drop view v4,v3,v2,v1;
drop table t1,t2;
#
# MDEV-3799 fix of above bugfix (MDEV-589)
# Wrong result (NULLs instead of real values) with RIGHT JOIN
# in a FROM subquery and derived_merge=on
#
CREATE TABLE t1 (f1 INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (4),(6);
CREATE TABLE t2 (f2 INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (7),(8);
SELECT * FROM (
SELECT * FROM t1 RIGHT JOIN t2 ON f1 = f2
) AS alias;
f1 f2
NULL 7
NULL 8
SELECT * FROM (
SELECT * FROM t2 LEFT JOIN t1 ON f1 = f2
) AS alias;
f2 f1
7 NULL
8 NULL
drop tables t1,t2;
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# -- End of 5.3 tests. # -- End of 5.3 tests.
# ----------------------------------------------------------------- # -----------------------------------------------------------------

View File

@ -4,7 +4,7 @@ create user pam_test;
grant proxy on pam_test to test_pam; grant proxy on pam_test to test_pam;
# #
# athentication is successful, challenge/pin are ok # athentication is successful, challenge/pin are ok
# note that current_user() differts from user() # note that current_user() differs from user()
# #
Challenge input first. Challenge input first.
Enter: not very secret challenge Enter: not very secret challenge

View File

@ -26,7 +26,7 @@ EOF
--echo # --echo #
--echo # athentication is successful, challenge/pin are ok --echo # athentication is successful, challenge/pin are ok
--echo # note that current_user() differts from user() --echo # note that current_user() differs from user()
--echo # --echo #
--exec $MYSQL_TEST -u test_pam --plugin-dir=$plugindir < $MYSQLTEST_VARDIR/tmp/pam_good.txt --exec $MYSQL_TEST -u test_pam --plugin-dir=$plugindir < $MYSQLTEST_VARDIR/tmp/pam_good.txt

View File

@ -0,0 +1,49 @@
select @@ignore_db_dirs;
@@ignore_db_dirs
e,lost+found,.mysqlgui,ignored_db
# Check that SHOW DATABASES ignores all directories from
# @@ignore_db_dirs and all directories with names starting
# with '.'
SHOW DATABASES;
Database
information_schema
#mysql50#.otherdir
mtr
mysql
performance_schema
test
USE ignored_db;
ERROR 42000: Incorrect database name 'ignored_db'
SELECT * FROM ignored_db.t1;
ERROR 42000: Incorrect database name 'ignored_db'
CALL ignored_db.p1();
ERROR 42000: Incorrect database name 'ignored_db'
SELECT COUNT(*) FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='ignored_db';
COUNT(*)
1
CREATE DATABASE ignored_db;
ERROR 42000: Incorrect database name 'ignored_db'
CREATE DATABASE `lost+found`;
USE `lost+found`;
CREATE TABLE t1(id INT);
INSERT INTO t1 VALUES (1), (2);
SELECT * FROM `lost+found`.t1;
id
1
2
SHOW DATABASES;
Database
information_schema
#mysql50#.otherdir
lost+found
mtr
mysql
performance_schema
test
DROP DATABASE `lost+found`;
SET @@global.ignore_db_dirs = 'aha';
ERROR HY000: Variable 'ignore_db_dirs' is a read only variable
SET @@local.ignore_db_dirs = 'aha';
ERROR HY000: Variable 'ignore_db_dirs' is a read only variable
SET @@ignore_db_dirs = 'aha';
ERROR HY000: Variable 'ignore_db_dirs' is a read only variable

View File

@ -0,0 +1,11 @@
--ignore-db-dir=a
--ignore-db-dir=b
--ignore-db-dir=c
--ignore-db-dir=
--ignore-db-dir=d
--ignore-db-dir x
--ignore-db-dir=
--ignore-db-dir=e
--ignore-db-dir=lost+found
--ignore-db-dir=.mysqlgui
--ignore-db-dir=ignored_db

View File

@ -0,0 +1,38 @@
select @@ignore_db_dirs;
let $MYSQLD_DATADIR= `select @@datadir`;
mkdir $MYSQLD_DATADIR/.mysqlgui;
mkdir $MYSQLD_DATADIR/.otherdir;
mkdir $MYSQLD_DATADIR/lost+found;
mkdir $MYSQLD_DATADIR/ignored_db;
--echo # Check that SHOW DATABASES ignores all directories from
--echo # @@ignore_db_dirs and all directories with names starting
--echo # with '.'
SHOW DATABASES;
--error ER_WRONG_DB_NAME
USE ignored_db;
--error ER_WRONG_DB_NAME
SELECT * FROM ignored_db.t1;
--error ER_WRONG_DB_NAME
CALL ignored_db.p1();
SELECT COUNT(*) FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='ignored_db';
--error ER_WRONG_DB_NAME
CREATE DATABASE ignored_db;
CREATE DATABASE `lost+found`;
USE `lost+found`;
CREATE TABLE t1(id INT);
INSERT INTO t1 VALUES (1), (2);
SELECT * FROM `lost+found`.t1;
SHOW DATABASES;
DROP DATABASE `lost+found`;
rmdir $MYSQLD_DATADIR/.mysqlgui;
rmdir $MYSQLD_DATADIR/.otherdir;
rmdir $MYSQLD_DATADIR/lost+found;
rmdir $MYSQLD_DATADIR/ignored_db;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@global.ignore_db_dirs = 'aha';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@local.ignore_db_dirs = 'aha';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@ignore_db_dirs = 'aha';

View File

@ -3587,5 +3587,54 @@ set optimizer_switch=@tmp_optimizer_switch;
DROP TABLE t1,t2,t3; DROP TABLE t1,t2,t3;
--echo #
--echo # Bug #1058071: LEFT JOIN using blobs
--echo # (mdev-564) when join buffer size is small
--echo #
CREATE TABLE t1 (
col269 decimal(31,10) unsigned DEFAULT NULL,
col280 multipoint DEFAULT NULL,
col281 tinyint(1) DEFAULT NULL,
col282 time NOT NULL,
col284 datetime DEFAULT NULL,
col286 date DEFAULT NULL,
col287 datetime DEFAULT NULL,
col288 decimal(30,29) DEFAULT NULL,
col291 time DEFAULT NULL,
col292 time DEFAULT NULL
) ENGINE=Aria;
INSERT INTO t1 VALUES
(0.0,PointFromText('POINT(9 0)'),0,'11:24:05','2013-04-14 21:30:28',NULL,'2011-12-20 06:00:34',9.9,'13:04:39',NULL),
(0.0,NULL,127,'05:43:12','2012-09-05 06:15:27','2027-01-01','2011-10-29 10:48:29',0.0,'06:24:05','11:33:37'),
(0.0,NULL,127,'12:54:41','2013-01-12 11:32:58','2011-11-03','2013-01-03 02:00:34',00,'11:54:15','20:19:15'),
(0.0,PointFromText('POINT(9 0)'),0,'19:48:07','2012-07-16 15:45:25','2012-03-25','2013-09-07 17:21:52',0.5,'17:36:54','21:24:19'),
(0.0,PointFromText('POINT(9 0)'),0,'03:43:48','2012-09-28 00:00:00','2012-06-26','2011-11-16 05:01:09',00,'01:25:42','19:30:06'),
(0.0,LineStringFromText('LINESTRING(0 0,9 9,0 0,9 0,0 0)'),127,'11:33:21','2012-03-31 10:29:22','2012-10-10','2012-04-21 19:21:06',NULL,'05:13:22','09:48:34'),
(NULL,PointFromText('POINT(9 0)'),127,'00:00:00','0000-00-00','2012-04-04 21:26:12','2013-03-04',0.0,'12:54:30',NULL),
(NULL,PointFromText('POINT(9 0)'),1,'00:00:00','2013-05-01 22:37:49','2013-06-26','2012-09-22 17:31:03',0.0,'08:09:57','11:15:36');
CREATE TABLE t2 (b int) ENGINE=Aria;
INSERT INTO t2 VALUES (NULL);
CREATE TABLE t3 (c int) ENGINE=Aria;
INSERT INTO t3 VALUES (NULL);
set @tmp_optimizer_switch=@@optimizer_switch;
set optimizer_switch = 'outer_join_with_cache=on,join_cache_incremental=on';
set join_buffer_size=128;
EXPLAIN
SELECT 1 AS c FROM t1 NATURAL LEFT JOIN t2 LEFT OUTER JOIN t3 ON 1
GROUP BY elt(t1.col282,1,t1.col280);
SELECT 1 AS c FROM t1 NATURAL LEFT JOIN t2 LEFT OUTER JOIN t3 ON 1
GROUP BY elt(t1.col282,1,t1.col280);
set join_buffer_size=default;
set optimizer_switch=@tmp_optimizer_switch;
DROP table t1,t2,t3;
# this must be the last command in the file # this must be the last command in the file
set @@optimizer_switch=@save_optimizer_switch; set @@optimizer_switch=@save_optimizer_switch;

View File

@ -4174,7 +4174,7 @@ INSERT INTO t5 VALUES (20),(5);
CREATE TABLE t6(f1 int); CREATE TABLE t6(f1 int);
INSERT INTO t6 VALUES (9),(7); INSERT INTO t6 VALUES (9),(7);
SET SESSION join_buffer_size = 2048; SET SESSION join_buffer_size = 2176;
EXPLAIN EXPLAIN
SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6; SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;

View File

@ -5596,6 +5596,22 @@ set optimizer_switch=@mdev367_optimizer_switch;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-521 single value subselect transformation problem
--echo #
CREATE TABLE t1 (f1 char(2), PRIMARY KEY (f1)) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('u1'),('u2');
SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) );
FLUSH TABLES;
SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) );
# Cleanup
DROP TABLE t1;
--echo # return optimizer switch changed in the beginning of this test
set optimizer_switch=@subselect_tmp;
--echo # --echo #
--echo # lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not --echo # lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not
--echo # precomputed and thus not part of optimization --echo # precomputed and thus not part of optimization

View File

@ -203,5 +203,24 @@ SET optimizer_switch=@tmp_optimizer_switch;
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1,t2,t3; DROP TABLE t1,t2,t3;
--echo #
--echo # MDEV-567: Wrong result from a query with correlated subquery if ICP is allowed
--echo #
CREATE TABLE t1 (a int, b int, INDEX idx(a));
INSERT INTO t1 VALUES (9,0), (7,1), (1,9), (7,3), (2,1);
CREATE TABLE t2 (a int, b int, INDEX idx(a));
INSERT INTO t2 VALUES (2,1), (6,4), (7,6), (9,4);
CREATE TABLE t3 (a int, b int);
INSERT INTO t3 VALUES (1,0), (1,1), (1,3);
SELECT * FROM t3
WHERE a = (SELECT COUNT(DISTINCT t2.b) FROM t1, t2
WHERE t1.a = t2.a AND t2.a BETWEEN 7 AND 9
AND t3.b = t1.b
GROUP BY t1.b);
DROP TABLE t1, t2, t3;
set optimizer_switch=@subselect2_test_tmp; set optimizer_switch=@subselect2_test_tmp;

View File

@ -4381,6 +4381,46 @@ SELECT * FROM v1, t2
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1,t2,t3,t4; DROP TABLE t1,t2,t3,t4;
--echo #
--echo # LP bug #823237: dependent subquery with LEFT JOIN
--echo # referencing view in WHERE
--echo # (duplicate of LP bug #823189)
--echo #
CREATE TABLE t1 (a int);
CREATE TABLE t2 ( b int, d int, e int);
INSERT INTO t2 VALUES (7,8,0);
CREATE TABLE t3 ( c int);
INSERT INTO t3 VALUES (0);
CREATE TABLE t4 (a int, b int, c int);
INSERT INTO t4 VALUES (93,1,0), (95,NULL,0);
CREATE VIEW v4 AS SELECT * FROM t4;
EXPLAIN EXTENDED
SELECT * FROM t3 , t4
WHERE t4.c <= (SELECT t2.e FROM t2 LEFT JOIN t1 ON ( t1.a = t2.d )
WHERE t2.b > t4.b);
SELECT * FROM t3 , t4
WHERE t4.c <= (SELECT t2.e FROM t2 LEFT JOIN t1 ON ( t1.a = t2.d )
WHERE t2.b > t4.b);
EXPLAIN EXTENDED
SELECT * FROM t3, v4
WHERE v4.c <= (SELECT t2.e FROM t2 LEFT JOIN t1 ON ( t1.a = t2.d )
WHERE t2.b > v4.b);
SELECT * FROM t3, v4
WHERE v4.c <= (SELECT t2.e FROM t2 LEFT JOIN t1 ON ( t1.a = t2.d )
WHERE t2.b > v4.b);
DROP VIEW v4;
DROP TABLE t1,t2,t3,t4;
# #
# Bug#9801 (Views: imperfect error message) # Bug#9801 (Views: imperfect error message)
# #
@ -4661,6 +4701,52 @@ create algorithm=MERGE view v2 as select 2 as id, id is null as bbb, id as iddqd
select t1.*, v2.* from t1 left join v2 on t1.id = v2.id; select t1.*, v2.* from t1 left join v2 on t1.id = v2.id;
drop view v2; drop view v2;
drop table t1,t2; drop table t1,t2;
--echo #
--echo # MDEV-589 (LP BUG#1007647) :
--echo # Assertion `vcol_table == 0 || vcol_table == table' failed in
--echo # fill_record(THD*, List<Item>&, List<Item>&, bool)
--echo #
CREATE TABLE t1 (f1 INT, f2 INT);
CREATE TABLE t2 (f1 INT, f2 INT);
CREATE ALGORITHM=MERGE VIEW v1 AS SELECT a1.f1, a2.f2 FROM t1 AS a1, t1 AS a2;
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM v1;
CREATE ALGORITHM=MERGE VIEW v3 AS SELECT a1.f1, a2.f2 FROM t1 AS a1, t2 AS a2;
CREATE ALGORITHM=MERGE VIEW v4 AS SELECT * FROM v3;
--error ER_VIEW_MULTIUPDATE
INSERT INTO v3 (f1, f2) VALUES (1, 2);
--error ER_VIEW_MULTIUPDATE
INSERT INTO v1 (f1, f2) VALUES (1, 2);
--error ER_VIEW_MULTIUPDATE
INSERT INTO v4 (f1, f2) VALUES (1, 2);
--error ER_VIEW_MULTIUPDATE
INSERT INTO v2 (f1, f2) VALUES (1, 2);
drop view v4,v3,v2,v1;
drop table t1,t2;
--echo #
--echo # MDEV-3799 fix of above bugfix (MDEV-589)
--echo # Wrong result (NULLs instead of real values) with RIGHT JOIN
--echo # in a FROM subquery and derived_merge=on
--echo #
CREATE TABLE t1 (f1 INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (4),(6);
CREATE TABLE t2 (f2 INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (7),(8);
SELECT * FROM (
SELECT * FROM t1 RIGHT JOIN t2 ON f1 = f2
) AS alias;
SELECT * FROM (
SELECT * FROM t2 LEFT JOIN t1 ON f1 = f2
) AS alias;
drop tables t1,t2;
--echo # ----------------------------------------------------------------- --echo # -----------------------------------------------------------------
--echo # -- End of 5.3 tests. --echo # -- End of 5.3 tests.
--echo # ----------------------------------------------------------------- --echo # -----------------------------------------------------------------

View File

@ -0,0 +1,93 @@
/*
Pam module to change user names arbitrarily in the pam stack.
Compile as
gcc pam_user_map.c -shared -lpam -fPIC -o pam_user_map.so
Install as appropriate (for example, in /lib/security/).
Add to your /etc/pam.d/mysql (preferrably, at the end) this line:
=========================================================
auth required pam_user_map.so
=========================================================
And create /etc/security/user_map.conf with the desired mapping
in the format: orig_user_name: mapped_user_name
=========================================================
#comments and emty lines are ignored
john: jack
bob: admin
top: accounting
=========================================================
*/
#include <stdio.h>
#include <syslog.h>
#include <security/pam_modules.h>
#define FILENAME "/etc/security/user_map.conf"
#define skip(what) while (*s && (what)) s++
int pam_sm_authenticate(pam_handle_t *pamh, int flags,
int argc, const char *argv[])
{
int pam_err, line= 0;
const char *username;
char buf[256];
FILE *f;
f= fopen(FILENAME, "r");
if (f == NULL)
{
pam_syslog(pamh, LOG_ERR, "Cannot open '%s'\n", FILENAME);
return PAM_SYSTEM_ERR;
}
pam_err = pam_get_item(pamh, PAM_USER, (const void**)&username);
if (pam_err != PAM_SUCCESS)
goto ret;
while (fgets(buf, sizeof(buf), f) != NULL)
{
char *s= buf, *from, *to, *end_from, *end_to;
line++;
skip(isspace(*s));
if (*s == '#' || *s == 0) continue;
from= s;
skip(isalnum(*s) || (*s == '_'));
end_from= s;
skip(isspace(*s));
if (end_from == from || *s++ != ':') goto syntax_error;
skip(isspace(*s));
to= s;
skip(isalnum(*s) || (*s == '_'));
end_to= s;
if (end_to == to) goto syntax_error;
*end_from= *end_to= 0;
if (strcmp(username, from) == 0)
{
pam_err= pam_set_item(pamh, PAM_USER, to);
goto ret;
}
}
pam_err= PAM_SUCCESS;
goto ret;
syntax_error:
pam_syslog(pamh, LOG_ERR, "Syntax error at %s:%d", FILENAME, line);
pam_err= PAM_SYSTEM_ERR;
ret:
fclose(f);
return pam_err;
}
int pam_sm_setcred(pam_handle_t *pamh, int flags,
int argc, const char *argv[])
{
return PAM_SUCCESS;
}

View File

@ -12,7 +12,7 @@
Create /etc/pam.d/mariadb_mtr with Create /etc/pam.d/mariadb_mtr with
========================================================= =========================================================
auth required pam_mariadb_mtr.so pam_test auth required pam_mariadb_mtr.so pam_test
account required pam_mariadb_mtr.so account required pam_permit.so
========================================================= =========================================================
*/ */
@ -23,9 +23,8 @@ account required pam_mariadb_mtr.so
#define N 3 #define N 3
PAM_EXTERN int int pam_sm_authenticate(pam_handle_t *pamh, int flags,
pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, const char *argv[])
int argc, const char *argv[])
{ {
struct pam_conv *conv; struct pam_conv *conv;
struct pam_response *resp = 0; struct pam_response *resp = 0;
@ -71,17 +70,8 @@ ret:
return retval; return retval;
} }
PAM_EXTERN int int pam_sm_setcred(pam_handle_t *pamh, int flags,
pam_sm_setcred(pam_handle_t *pamh, int flags, int argc, const char *argv[])
int argc, const char *argv[])
{
return PAM_SUCCESS;
}
PAM_EXTERN int
pam_sm_acct_mgmt(pam_handle_t *pamh, int flags,
int argc, const char *argv[])
{ {
return PAM_SUCCESS; return PAM_SUCCESS;

View File

@ -257,7 +257,7 @@ fi
# Now we can get arguments from the groups [mysqld] and [mysql_install_db] # Now we can get arguments from the groups [mysqld] and [mysql_install_db]
# in the my.cfg file, then re-run to merge with command line arguments. # in the my.cfg file, then re-run to merge with command line arguments.
parse_arguments `$print_defaults $defaults mysqld mariadb mysql_install_db client-server` parse_arguments `"$print_defaults" $defaults mysqld mariadb mysql_install_db client-server`
parse_arguments PICK-ARGS-FROM-ARGV "$@" parse_arguments PICK-ARGS-FROM-ARGV "$@"
# Configure paths to support files # Configure paths to support files
@ -307,7 +307,7 @@ fill_help_tables="$pkgdatadir/fill_help_tables.sql"
create_system_tables="$pkgdatadir/mysql_system_tables.sql" create_system_tables="$pkgdatadir/mysql_system_tables.sql"
fill_system_tables="$pkgdatadir/mysql_system_tables_data.sql" fill_system_tables="$pkgdatadir/mysql_system_tables_data.sql"
for f in $fill_help_tables $create_system_tables $fill_system_tables for f in "$fill_help_tables" "$create_system_tables" "$fill_system_tables"
do do
if test ! -f "$f" if test ! -f "$f"
then then
@ -329,8 +329,10 @@ then
cannot_find_file "$langdir/errmsg.sys" cannot_find_file "$langdir/errmsg.sys"
exit 1 exit 1
fi fi
mysqld_opt="--lc-messages-dir=$langdir/.." else
langdir=english
fi fi
mysqld_opt="--lc-messages=$langdir"
# Try to determine the hostname # Try to determine the hostname
hostname=`@HOSTNAME@` hostname=`@HOSTNAME@`
@ -338,14 +340,14 @@ hostname=`@HOSTNAME@`
# Check if hostname is valid # Check if hostname is valid
if test "$cross_bootstrap" -eq 0 -a "$in_rpm" -eq 0 -a "$force" -eq 0 if test "$cross_bootstrap" -eq 0 -a "$in_rpm" -eq 0 -a "$force" -eq 0
then then
resolved=`$extra_bindir/resolveip $hostname 2>&1` resolved=`"$extra_bindir/resolveip" $hostname 2>&1`
if test $? -ne 0 if test $? -ne 0
then then
resolved=`$extra_bindir/resolveip localhost 2>&1` resolved=`"$extra_bindir/resolveip" localhost 2>&1`
if test $? -ne 0 if test $? -ne 0
then then
echo "Neither host '$hostname' nor 'localhost' could be looked up with" echo "Neither host '$hostname' nor 'localhost' could be looked up with"
echo "$extra_bindir/resolveip" echo "'$extra_bindir/resolveip'"
echo "Please configure the 'hostname' command to return a correct" echo "Please configure the 'hostname' command to return a correct"
echo "hostname." echo "hostname."
echo "If you want to solve this at a later stage, restart this script" echo "If you want to solve this at a later stage, restart this script"
@ -368,21 +370,21 @@ then
fi fi
# Create database directories # Create database directories
for dir in $ldata $ldata/mysql $ldata/test for dir in "$ldata" "$ldata/mysql" "$ldata/test"
do do
if test ! -d $dir if test ! -d "$dir"
then then
if ! `mkdir -p $dir` if ! `mkdir -p "$dir"`
then then
echo "Fatal error Can't create database directory '$dir'" echo "Fatal error Can't create database directory '$dir'"
link_to_help link_to_help
exit 1 exit 1
fi fi
chmod 700 $dir chmod 700 "$dir"
fi fi
if test -n "$user" if test -n "$user"
then then
chown $user $dir chown $user "$dir"
if test $? -ne 0 if test $? -ne 0
then then
echo "Cannot change ownership of the database directories to the '$user'" echo "Cannot change ownership of the database directories to the '$user'"
@ -409,15 +411,19 @@ fi
# Configure mysqld command line # Configure mysqld command line
mysqld_bootstrap="${MYSQLD_BOOTSTRAP-$mysqld}" mysqld_bootstrap="${MYSQLD_BOOTSTRAP-$mysqld}"
mysqld_install_cmd_line="$mysqld_bootstrap $defaults $mysqld_opt --bootstrap \ mysqld_install_cmd_line()
--basedir=$basedir --datadir=$ldata --log-warnings=0 --loose-skip-innodb \ {
"$mysqld_bootstrap" $defaults "$mysqld_opt" --bootstrap \
"--basedir=$basedir" "--datadir=$ldata" --log-warnings=0 --loose-skip-innodb \
--loose-skip-ndbcluster --loose-skip-pbxt $args --max_allowed_packet=8M \ --loose-skip-ndbcluster --loose-skip-pbxt $args --max_allowed_packet=8M \
--default-storage-engine=myisam \ --default-storage-engine=myisam \
--net_buffer_length=16K" --net_buffer_length=16K
}
# Create the system and help tables by passing them to "mysqld --bootstrap" # Create the system and help tables by passing them to "mysqld --bootstrap"
s_echo "Installing MariaDB/MySQL system tables in '$ldata' ..." s_echo "Installing MariaDB/MySQL system tables in '$ldata' ..."
if { echo "use mysql;"; cat $create_system_tables $fill_system_tables; } | eval "$filter_cmd_line" | $mysqld_install_cmd_line > /dev/null if { echo "use mysql;"; cat "$create_system_tables" "$fill_system_tables"; } | eval "$filter_cmd_line" | mysqld_install_cmd_line > /dev/null
then then
s_echo "OK" s_echo "OK"
else else
@ -452,7 +458,7 @@ else
fi fi
s_echo "Filling help tables..." s_echo "Filling help tables..."
if { echo "use mysql;"; cat $fill_help_tables; } | $mysqld_install_cmd_line > /dev/null if { echo "use mysql;"; cat "$fill_help_tables"; } | mysqld_install_cmd_line > /dev/null
then then
s_echo "OK" s_echo "OK"
else else
@ -474,11 +480,11 @@ then
echo "PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !" echo "PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !"
echo "To do so, start the server, then issue the following commands:" echo "To do so, start the server, then issue the following commands:"
echo echo
echo "$bindir/mysqladmin -u root password 'new-password'" echo "'$bindir/mysqladmin' -u root password 'new-password'"
echo "$bindir/mysqladmin -u root -h $hostname password 'new-password'" echo "'$bindir/mysqladmin' -u root -h $hostname password 'new-password'"
echo echo
echo "Alternatively you can run:" echo "Alternatively you can run:"
echo "$bindir/mysql_secure_installation" echo "'$bindir/mysql_secure_installation'"
echo echo
echo "which will also give you the option of removing the test" echo "which will also give you the option of removing the test"
echo "databases and anonymous user created by default. This is" echo "databases and anonymous user created by default. This is"
@ -491,14 +497,14 @@ then
then then
echo echo
echo "You can start the MariaDB daemon with:" echo "You can start the MariaDB daemon with:"
echo "cd $basedir ; $bindir/mysqld_safe --datadir=$ldata" echo "cd '$basedir' ; $bindir/mysqld_safe --datadir='$ldata'"
echo echo
echo "You can test the MariaDB daemon with mysql-test-run.pl" echo "You can test the MariaDB daemon with mysql-test-run.pl"
echo "cd $basedir/mysql-test ; perl mysql-test-run.pl" echo "cd '$basedir/mysql-test' ; perl mysql-test-run.pl"
fi fi
echo echo
echo "Please report any problems with the $scriptdir/mysqlbug script!" echo "Please report any problems with the '$scriptdir/mysqlbug' script!"
echo echo
echo "The latest information about MariaDB is available at http://mariadb.org/." echo "The latest information about MariaDB is available at http://mariadb.org/."
echo "You can find additional information about the MySQL part at:" echo "You can find additional information about the MySQL part at:"

View File

@ -137,11 +137,8 @@ static bool set_one_value(ha_create_table_option *opt,
my_option optp= my_option optp=
{ opt->name, 1, 0, (uchar **)val, 0, 0, GET_ULL, { opt->name, 1, 0, (uchar **)val, 0, 0, GET_ULL,
REQUIRED_ARG, REQUIRED_ARG, (longlong)opt->def_value, (longlong)opt->min_value,
(longlong) opt->def_value, opt->max_value, 0, (long) opt->block_size, 0};
(longlong) opt->min_value,
opt->max_value,
0, (long) opt->block_size, 0};
ulonglong orig_val= strtoull(value->str, NULL, 10); ulonglong orig_val= strtoull(value->str, NULL, 10);
my_bool unused; my_bool unused;

View File

@ -9609,7 +9609,7 @@ table_map Item_direct_view_ref::used_tables() const
{ {
return get_depended_from() ? return get_depended_from() ?
OUTER_REF_TABLE_BIT : OUTER_REF_TABLE_BIT :
((view->merged || !view->table) ? ((view->is_merged_derived() || view->merged || !view->table) ?
(*ref)->used_tables() : (*ref)->used_tables() :
view->table->map); view->table->map);
} }
@ -9618,7 +9618,7 @@ table_map Item_direct_view_ref::not_null_tables() const
{ {
return get_depended_from() ? return get_depended_from() ?
0 : 0 :
((view->merged || !view->table) ? ((view->is_merged_derived() || view->merged || !view->table) ?
(*ref)->not_null_tables() : (*ref)->not_null_tables() :
view->table->map); view->table->map);
} }

View File

@ -1063,11 +1063,9 @@ Item_singlerow_subselect::select_transformer(JOIN *join)
} }
substitution= select_lex->item_list.head(); substitution= select_lex->item_list.head();
/* /*
as far as we moved content to upper level, field which depend of as far as we moved content to upper level we have to fix dependences & Co
'upper' select is not really dependent => we remove this dependence
*/ */
substitution->walk(&Item::remove_dependence_processor, 0, substitution->fix_after_pullout(select_lex->outer_select(), &substitution);
(uchar *) select_lex->outer_select());
} }
DBUG_RETURN(false); DBUG_RETURN(false);
} }

View File

@ -1797,6 +1797,7 @@ void clean_up(bool print_message)
#endif #endif
my_tz_free(); my_tz_free();
my_dboptions_cache_free(); my_dboptions_cache_free();
ignore_db_dirs_free();
#ifndef NO_EMBEDDED_ACCESS_CHECKS #ifndef NO_EMBEDDED_ACCESS_CHECKS
servers_free(1); servers_free(1);
acl_free(1); acl_free(1);
@ -3440,6 +3441,9 @@ static int init_common_variables()
mysql_init_variables()) mysql_init_variables())
return 1; return 1;
if (ignore_db_dirs_init())
return 1;
#ifdef HAVE_TZNAME #ifdef HAVE_TZNAME
struct tm tm_tmp; struct tm tm_tmp;
localtime_r(&server_start_time,&tm_tmp); localtime_r(&server_start_time,&tm_tmp);
@ -3868,6 +3872,12 @@ You should consider changing lower_case_table_names to 1 or 2",
files_charset_info : files_charset_info :
&my_charset_bin); &my_charset_bin);
if (ignore_db_dirs_process_additions())
{
sql_print_error("An error occurred while storing ignore_db_dirs to a hash.");
return 1;
}
return 0; return 0;
} }
@ -6310,7 +6320,7 @@ struct my_option my_long_options[]=
#ifdef HAVE_MMAP #ifdef HAVE_MMAP
{"log-tc-size", 0, "Size of transaction coordinator log.", {"log-tc-size", 0, "Size of transaction coordinator log.",
&opt_tc_log_size, &opt_tc_log_size, 0, GET_ULONG, &opt_tc_log_size, &opt_tc_log_size, 0, GET_ULONG,
REQUIRED_ARG, TC_LOG_MIN_SIZE, TC_LOG_MIN_SIZE, (longlong) ULONG_MAX, 0, REQUIRED_ARG, TC_LOG_MIN_SIZE, TC_LOG_MIN_SIZE, (ulonglong) ULONG_MAX, 0,
TC_LOG_PAGE_SIZE, 0}, TC_LOG_PAGE_SIZE, 0},
#endif #endif
{"master-info-file", 0, {"master-info-file", 0,
@ -7736,6 +7746,22 @@ mysqld_get_one_option(int optid,
case OPT_MAX_LONG_DATA_SIZE: case OPT_MAX_LONG_DATA_SIZE:
max_long_data_size_used= true; max_long_data_size_used= true;
break; break;
case OPT_IGNORE_DB_DIRECTORY:
if (*argument == 0)
ignore_db_dirs_reset();
else
{
if (push_ignored_db_dir(argument))
{
sql_print_error("Can't start server: "
"cannot process --ignore-db-dir=%.*s",
FN_REFLEN, argument);
return 1;
}
}
break;
} }
return 0; return 0;
} }

View File

@ -368,19 +368,23 @@ enum options_mysqld
OPT_BINLOG_FORMAT, OPT_BINLOG_FORMAT,
OPT_BINLOG_IGNORE_DB, OPT_BINLOG_IGNORE_DB,
OPT_BIN_LOG, OPT_BIN_LOG,
OPT_LOG_BASENAME,
OPT_BOOTSTRAP, OPT_BOOTSTRAP,
OPT_CONSOLE, OPT_CONSOLE,
OPT_DEBUG_SYNC_TIMEOUT, OPT_DEBUG_SYNC_TIMEOUT,
OPT_DELAY_KEY_WRITE_ALL, OPT_DELAY_KEY_WRITE_ALL,
OPT_DEPRECATED_OPTION, OPT_DEPRECATED_OPTION,
OPT_ENGINE_CONDITION_PUSHDOWN,
OPT_IGNORE_DB_DIRECTORY,
OPT_ISAM_LOG, OPT_ISAM_LOG,
OPT_KEY_BUFFER_SIZE, OPT_KEY_BUFFER_SIZE,
OPT_KEY_CACHE_AGE_THRESHOLD, OPT_KEY_CACHE_AGE_THRESHOLD,
OPT_KEY_CACHE_BLOCK_SIZE, OPT_KEY_CACHE_BLOCK_SIZE,
OPT_KEY_CACHE_DIVISION_LIMIT, OPT_KEY_CACHE_DIVISION_LIMIT,
OPT_KEY_CACHE_PARTITIONS, OPT_KEY_CACHE_PARTITIONS,
OPT_LOG_BASENAME,
OPT_LOG_ERROR,
OPT_LOWER_CASE_TABLE_NAMES, OPT_LOWER_CASE_TABLE_NAMES,
OPT_MAX_LONG_DATA_SIZE,
OPT_ONE_THREAD, OPT_ONE_THREAD,
OPT_POOL_OF_THREADS, OPT_POOL_OF_THREADS,
OPT_REPLICATE_DO_DB, OPT_REPLICATE_DO_DB,
@ -406,9 +410,7 @@ enum options_mysqld
OPT_SSL_KEY, OPT_SSL_KEY,
OPT_UPDATE_LOG, OPT_UPDATE_LOG,
OPT_WANT_CORE, OPT_WANT_CORE,
OPT_ENGINE_CONDITION_PUSHDOWN, OPT_which_is_always_the_last
OPT_LOG_ERROR,
OPT_MAX_LONG_DATA_SIZE
}; };
#endif #endif

View File

@ -681,7 +681,23 @@ void JOIN_CACHE::set_constants()
uint len= length + fields*sizeof(uint)+blobs*sizeof(uchar *) + uint len= length + fields*sizeof(uint)+blobs*sizeof(uchar *) +
(prev_cache ? prev_cache->get_size_of_rec_offset() : 0) + (prev_cache ? prev_cache->get_size_of_rec_offset() : 0) +
sizeof(ulong); sizeof(ulong);
buff_size= max(join->thd->variables.join_buff_size, 2*len); /*
The values of size_of_rec_ofs, size_of_rec_len, size_of_fld_ofs,
base_prefix_length, pack_length, pack_length_with_blob_ptrs
will be recalculated later in this function when we get the estimate
for the actual value of the join buffer size.
*/
size_of_rec_ofs= size_of_rec_len= size_of_fld_ofs= 4;
base_prefix_length= (with_length ? size_of_rec_len : 0) +
(prev_cache ? prev_cache->get_size_of_rec_offset() : 0);
pack_length= (with_length ? size_of_rec_len : 0) +
(prev_cache ? prev_cache->get_size_of_rec_offset() : 0) +
length + fields*sizeof(uint);
pack_length_with_blob_ptrs= pack_length + blobs*sizeof(uchar *);
min_buff_size= 0;
min_records= 1;
buff_size= max(join->thd->variables.join_buff_size,
get_min_join_buffer_size());
size_of_rec_ofs= offset_size(buff_size); size_of_rec_ofs= offset_size(buff_size);
size_of_rec_len= blobs ? size_of_rec_ofs : offset_size(len); size_of_rec_len= blobs ? size_of_rec_ofs : offset_size(len);
size_of_fld_ofs= size_of_rec_len; size_of_fld_ofs= size_of_rec_len;
@ -754,19 +770,24 @@ ulong JOIN_CACHE::get_min_join_buffer_size()
if (!min_buff_size) if (!min_buff_size)
{ {
size_t len= 0; size_t len= 0;
size_t len_last= 0;
for (JOIN_TAB *tab= start_tab; tab != join_tab; for (JOIN_TAB *tab= start_tab; tab != join_tab;
tab= next_linear_tab(join, tab, WITHOUT_BUSH_ROOTS)) tab= next_linear_tab(join, tab, WITHOUT_BUSH_ROOTS))
{ {
len+= tab->get_max_used_fieldlength(); len+= tab->get_max_used_fieldlength();
len_last=+ tab->get_used_fieldlength();
} }
len+= get_record_max_affix_length() + get_max_key_addon_space_per_record(); size_t len_addon= get_record_max_affix_length() +
size_t min_sz= len*min_records; get_max_key_addon_space_per_record();
len+= len_addon;
len_last+= len_addon;
size_t min_sz= len*(min_records-1) + len_last;
min_sz+= pack_length_with_blob_ptrs;
size_t add_sz= 0; size_t add_sz= 0;
for (uint i=0; i < min_records; i++) for (uint i=0; i < min_records; i++)
add_sz+= join_tab_scan->aux_buffer_incr(i+1); add_sz+= join_tab_scan->aux_buffer_incr(i+1);
avg_aux_buffer_incr= add_sz/min_records; avg_aux_buffer_incr= add_sz/min_records;
min_sz+= add_sz; min_sz+= add_sz;
min_sz+= pack_length_with_blob_ptrs;
set_if_bigger(min_sz, 1); set_if_bigger(min_sz, 1);
min_buff_size= min_sz; min_buff_size= min_sz;
} }

View File

@ -364,6 +364,8 @@ inline int hexchar_to_int(char c)
#define IS_TABLESPACES_NODEGROUP_ID 7 #define IS_TABLESPACES_NODEGROUP_ID 7
#define IS_TABLESPACES_TABLESPACE_COMMENT 8 #define IS_TABLESPACES_TABLESPACE_COMMENT 8
bool db_name_is_in_ignore_db_dirs_list(const char *dbase);
#endif /* MYSQL_SERVER */ #endif /* MYSQL_SERVER */
#endif /* MYSQL_CLIENT */ #endif /* MYSQL_CLIENT */

View File

@ -414,6 +414,281 @@ bool mysqld_show_privileges(THD *thd)
} }
/** Hash of LEX_STRINGs used to search for ignored db directories. */
static HASH ignore_db_dirs_hash;
/**
An array of LEX_STRING pointers to collect the options at
option parsing time.
*/
static DYNAMIC_ARRAY ignore_db_dirs_array;
/**
A value for the read only system variable to show a list of
ignored directories.
*/
char *opt_ignore_db_dirs= NULL;
/**
This flag is ON if:
- the list of ignored directories is not empty
- and some of the ignored directory names
need no tablename-to-filename conversion.
Otherwise, if the name of the directory contains
unconditional characters like '+' or '.', they
never can match the database directory name. So the
db_name_is_in_ignore_db_dirs_list() can just return at once.
*/
static bool skip_ignored_dir_check= TRUE;
/**
Sets up the data structures for collection of directories at option
processing time.
We need to collect the directories in an array first, because
we need the character sets initialized before setting up the hash.
@return state
@retval TRUE failed
@retval FALSE success
*/
bool
ignore_db_dirs_init()
{
return my_init_dynamic_array(&ignore_db_dirs_array, sizeof(LEX_STRING *),
0, 0);
}
/**
Retrieves the key (the string itself) from the LEX_STRING hash members.
Needed by hash_init().
@param data the data element from the hash
@param out len_ret Placeholder to return the length of the key
@param unused
@return a pointer to the key
*/
static uchar *
db_dirs_hash_get_key(const uchar *data, size_t *len_ret,
my_bool __attribute__((unused)))
{
LEX_STRING *e= (LEX_STRING *) data;
*len_ret= e->length;
return (uchar *) e->str;
}
/**
Wrap a directory name into a LEX_STRING and push it to the array.
Called at option processing time for each --ignore-db-dir option.
@param path the name of the directory to push
@return state
@retval TRUE failed
@retval FALSE success
*/
bool
push_ignored_db_dir(char *path)
{
LEX_STRING *new_elt;
char *new_elt_buffer;
size_t path_len= strlen(path);
if (!path_len || path_len >= FN_REFLEN)
return true;
// No need to normalize, it's only a directory name, not a path.
if (!my_multi_malloc(0,
&new_elt, sizeof(LEX_STRING),
&new_elt_buffer, path_len + 1,
NullS))
return true;
new_elt->str= new_elt_buffer;
memcpy(new_elt_buffer, path, path_len);
new_elt_buffer[path_len]= 0;
new_elt->length= path_len;
return insert_dynamic(&ignore_db_dirs_array, (uchar*) &new_elt);
}
/**
Clean up the directory ignore options accumulated so far.
Called at option processing time for each --ignore-db-dir option
with an empty argument.
*/
void
ignore_db_dirs_reset()
{
LEX_STRING **elt;
while (NULL!= (elt= (LEX_STRING **) pop_dynamic(&ignore_db_dirs_array)))
if (elt && *elt)
my_free(*elt);
}
/**
Free the directory ignore option variables.
Called at server shutdown.
*/
void
ignore_db_dirs_free()
{
if (opt_ignore_db_dirs)
{
my_free(opt_ignore_db_dirs);
opt_ignore_db_dirs= NULL;
}
ignore_db_dirs_reset();
delete_dynamic(&ignore_db_dirs_array);
my_hash_free(&ignore_db_dirs_hash);
}
/**
Initialize the ignore db directories hash and status variable from
the options collected in the array.
Called when option processing is over and the server's in-memory
structures are fully initialized.
@return state
@retval TRUE failed
@retval FALSE success
*/
static void dispose_db_dir(void *ptr)
{
my_free(ptr);
}
bool
ignore_db_dirs_process_additions()
{
ulong i;
size_t len;
char *ptr;
LEX_STRING *dir;
skip_ignored_dir_check= TRUE;
if (my_hash_init(&ignore_db_dirs_hash,
lower_case_table_names ?
character_set_filesystem : &my_charset_bin,
0, 0, 0, db_dirs_hash_get_key,
dispose_db_dir,
HASH_UNIQUE))
return true;
/* len starts from 1 because of the terminating zero. */
len= 1;
for (i= 0; i < ignore_db_dirs_array.elements; i++)
{
get_dynamic(&ignore_db_dirs_array, (uchar *) &dir, i);
len+= dir->length + 1; // +1 for the comma
if (skip_ignored_dir_check)
{
char buff[FN_REFLEN];
(void) tablename_to_filename(dir->str, buff, sizeof(buff));
skip_ignored_dir_check= strcmp(dir->str, buff) != 0;
}
}
/* No delimiter for the last directory. */
if (len > 1)
len--;
/* +1 the terminating zero */
ptr= opt_ignore_db_dirs= (char *) my_malloc(len + 1, MYF(0));
if (!ptr)
return true;
/* Make sure we have an empty string to start with. */
*ptr= 0;
for (i= 0; i < ignore_db_dirs_array.elements; i++)
{
get_dynamic(&ignore_db_dirs_array, (uchar *) &dir, i);
if (my_hash_insert(&ignore_db_dirs_hash, (uchar *) dir))
return true;
ptr= strnmov(ptr, dir->str, dir->length);
if (i + 1 < ignore_db_dirs_array.elements)
ptr= strmov(ptr, ",");
/*
Set the transferred array element to NULL to avoid double free
in case of error.
*/
dir= NULL;
set_dynamic(&ignore_db_dirs_array, (uchar *) &dir, i);
}
/* make sure the string is terminated */
DBUG_ASSERT(ptr - opt_ignore_db_dirs <= (ptrdiff_t) len);
*ptr= 0;
/*
It's OK to empty the array here as the allocated elements are
referenced through the hash now.
*/
reset_dynamic(&ignore_db_dirs_array);
return false;
}
/**
Check if a directory name is in the hash of ignored directories.
@return search result
@retval TRUE found
@retval FALSE not found
*/
static inline bool
is_in_ignore_db_dirs_list(const char *directory)
{
return ignore_db_dirs_hash.records &&
NULL != my_hash_search(&ignore_db_dirs_hash, (const uchar *) directory,
strlen(directory));
}
/**
Check if a database name is in the hash of ignored directories.
@return search result
@retval TRUE found
@retval FALSE not found
*/
bool
db_name_is_in_ignore_db_dirs_list(const char *directory)
{
char buff[FN_REFLEN];
uint buff_len;
if (skip_ignored_dir_check)
return 0;
buff_len= tablename_to_filename(directory, buff, sizeof(buff));
return my_hash_search(&ignore_db_dirs_hash, (uchar *) buff, buff_len)!=NULL;
}
/* /*
find_files() - find files in a given directory. find_files() - find files in a given directory.
@ -499,6 +774,9 @@ find_files(THD *thd, List<LEX_STRING> *files, const char *db,
if (!MY_S_ISDIR(file->mystat->st_mode)) if (!MY_S_ISDIR(file->mystat->st_mode))
continue; continue;
if (is_in_ignore_db_dirs_list(file->name))
continue;
file_name_len= filename_to_tablename(file->name, uname, sizeof(uname)); file_name_len= filename_to_tablename(file->name, uname, sizeof(uname));
if (wild) if (wild)
{ {

View File

@ -132,4 +132,12 @@ enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table);
/* These functions were under INNODB_COMPATIBILITY_HOOKS */ /* These functions were under INNODB_COMPATIBILITY_HOOKS */
int get_quote_char_for_identifier(THD *thd, const char *name, uint length); int get_quote_char_for_identifier(THD *thd, const char *name, uint length);
/* Handle the ignored database directories list for SHOW/I_S. */
bool ignore_db_dirs_init();
void ignore_db_dirs_free();
void ignore_db_dirs_reset();
bool ignore_db_dirs_process_additions();
bool push_ignored_db_dir(char *path);
extern char *opt_ignore_db_dirs;
#endif /* SQL_SHOW_H */ #endif /* SQL_SHOW_H */

View File

@ -48,6 +48,7 @@
#include <myisam.h> #include <myisam.h>
#include "log_slow.h" #include "log_slow.h"
#include "debug_sync.h" // DEBUG_SYNC #include "debug_sync.h" // DEBUG_SYNC
#include "sql_show.h"
#include "log_event.h" #include "log_event.h"
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
@ -3615,6 +3616,15 @@ static Sys_var_tz Sys_time_zone(
SESSION_VAR(time_zone), NO_CMD_LINE, SESSION_VAR(time_zone), NO_CMD_LINE,
DEFAULT(&default_tz), NO_MUTEX_GUARD, IN_BINLOG); DEFAULT(&default_tz), NO_MUTEX_GUARD, IN_BINLOG);
static Sys_var_charptr Sys_ignore_db_dirs(
"ignore_db_dirs",
"Specifies a directory to add to the ignore list when collecting "
"database names from the datadir. Put a blank argument to reset "
"the list accumulated so far.",
READ_ONLY GLOBAL_VAR(opt_ignore_db_dirs),
CMD_LINE(REQUIRED_ARG, OPT_IGNORE_DB_DIRECTORY),
IN_FS_CHARSET, DEFAULT(0));
static Sys_var_ulong Sys_sp_cache_size( static Sys_var_ulong Sys_sp_cache_size(
"stored_program_cache", "stored_program_cache",
"The soft upper limit for number of cached stored routines for " "The soft upper limit for number of cached stored routines for "

View File

@ -3444,6 +3444,9 @@ bool check_db_name(LEX_STRING *org_name)
if (lower_case_table_names && name != any_db) if (lower_case_table_names && name != any_db)
my_casedn_str(files_charset_info, name); my_casedn_str(files_charset_info, name);
if (db_name_is_in_ignore_db_dirs_list(name))
return 1;
return check_table_name(name, name_length, check_for_path_chars); return check_table_name(name, name_length, check_for_path_chars);
} }
@ -4967,7 +4970,16 @@ TABLE *TABLE_LIST::get_real_join_table()
tbl= (tbl->view != NULL ? tbl= (tbl->view != NULL ?
tbl->view->select_lex.get_table_list() : tbl->view->select_lex.get_table_list() :
tbl->derived->first_select()->get_table_list()); tbl->derived->first_select()->get_table_list());
/* find left table in outer join on this level */
while(tbl->outer_join & JOIN_TYPE_RIGHT)
{
DBUG_ASSERT(tbl->next_local);
tbl= tbl->next_local;
}
} }
return tbl->table; return tbl->table;
} }

View File

@ -1860,6 +1860,7 @@ struct TABLE_LIST
/* TRUE <=> derived table should be filled right after optimization. */ /* TRUE <=> derived table should be filled right after optimization. */
bool fill_me; bool fill_me;
/* TRUE <=> view/DT is merged. */ /* TRUE <=> view/DT is merged. */
/* TODO: replace with derived_type */
bool merged; bool merged;
bool merged_for_insert; bool merged_for_insert;
/* TRUE <=> don't prepare this derived table/view as it should be merged.*/ /* TRUE <=> don't prepare this derived table/view as it should be merged.*/

View File

@ -82,6 +82,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
#error #error
#endif #endif
DBUG_ENTER("walk_and_match"); DBUG_ENTER("walk_and_match");
LINT_INIT(subkeys.i);
LINT_INIT_STRUCT(subkeys); LINT_INIT_STRUCT(subkeys);