Commit 8cb7c903 authored by Tatiana A. Nurnberg's avatar Tatiana A. Nurnberg

auto-merge

parents b16ad3ba 0a6c5535
......@@ -40,6 +40,7 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
IO_CACHE file;
MI_INFO *isam=0;
uint found_merge_insert_method= 0;
my_bool bad_children= FALSE;
DBUG_ENTER("myrg_open");
LINT_INIT(key_parts);
......@@ -89,13 +90,13 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
fn_format(buff, buff, "", "", 0);
if (!(isam=mi_open(buff,mode,(handle_locking?HA_OPEN_WAIT_IF_LOCKED:0))))
{
my_errno= HA_ERR_WRONG_MRG_TABLE_DEF;
if (handle_locking & HA_OPEN_FOR_REPAIR)
{
myrg_print_wrong_table(buff);
bad_children= TRUE;
continue;
}
goto err;
goto bad_children;
}
if (!m_info) /* First file */
{
......@@ -122,13 +123,13 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
files++;
if (m_info->reclength != isam->s->base.reclength)
{
my_errno=HA_ERR_WRONG_MRG_TABLE_DEF;
if (handle_locking & HA_OPEN_FOR_REPAIR)
{
myrg_print_wrong_table(buff);
bad_children= TRUE;
continue;
}
goto err;
goto bad_children;
}
m_info->options|= isam->s->options;
m_info->records+= isam->state->records;
......@@ -141,8 +142,8 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
m_info->tables);
}
if (my_errno == HA_ERR_WRONG_MRG_TABLE_DEF)
goto err;
if (bad_children)
goto bad_children;
if (!m_info && !(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO),
MYF(MY_WME | MY_ZEROFILL))))
goto err;
......@@ -170,12 +171,14 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
pthread_mutex_unlock(&THR_LOCK_open);
DBUG_RETURN(m_info);
bad_children:
my_errno= HA_ERR_WRONG_MRG_TABLE_DEF;
err:
save_errno=my_errno;
switch (errpos) {
case 3:
while (files)
mi_close(m_info->open_tables[--files].table);
(void) mi_close(m_info->open_tables[--files].table);
my_free((char*) m_info,MYF(0));
/* Fall through */
case 2:
......
# include/count_sessions.inc
#
# SUMMARY
#
# Stores the number of current sessions in $count_sessions.
#
#
# USAGE
#
# Please look into include/wait_until_count_sessions.inc
# for examples of typical usage.
#
#
# EXAMPLE
# backup.test, grant3.test
#
#
# Created: 2009-01-14 mleich
#
let $count_sessions= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1);
# include/wait_until_count_sessions.inc
#
# SUMMARY
#
# Waits until the passed number ($count_sessions) of concurrent sessions was
# observed via
# SHOW STATUS LIKE 'Threads_connected'
# or the operation times out.
# Note: Starting with 5.1 we could also use
# SELECT COUNT(*) FROM information_schema.processlist
# I stay with "SHOW STATUS LIKE 'Threads_connected'" because this
# runs in all versions 5.0+
#
#
# USAGE
#
# let $count_sessions= 3;
# --source include/wait_until_count_sessions.inc
#
# OR typical example of a test which uses more than one session
# Such a test could harm successing tests if there is no server shutdown
# and start between.cw
#
# If the testing box is slow than the disconnect of sessions belonging to
# the current test might happen when the successing test gets executed.
# This means the successing test might see activities like unexpected
# rows within the general log or the PROCESSLIST.
# Example from bug http://bugs.mysql.com/bug.php?id=40377
# --- bzr_mysql-6.0-rpl/.../r/log_state.result
# +++ bzr_mysql-6.0-rpl/.../r/log_state.reject
# @@ -25,6 +25,7 @@
# event_time user_host ... command_type argument
# TIMESTAMP USER_HOST ... Query create table t1(f1 int)
# TIMESTAMP USER_HOST ... Query select * from mysql.general_log
# +TIMESTAMP USER_HOST ... Quit
# ....
#
# What to do?
# -----------
# <start of test>
# # Determine initial number of connections (set $count_sessions)
# --source include/count_sessions.inc
# ...
# connect (con1,.....)
# ...
# connection default;
# ...
# disconnect con1;
# ...
# # Wait until we have reached the initial number of connections
# # or more than the sleep time above (10 seconds) has passed.
# # $count_sessions
# --source include/wait_until_count_sessions.inc
# <end of test>
#
# Important note about tests with unfortunate (= not cooperative
# to successing tests) architecture:
# connection con1;
# send SELECT ..., sleep(10)
# connection default;
# ...
# disconnect con1;
# <end of test>
# should be fixed by
# connection con1;
# send SELECT ..., sleep(10)
# connection default;
# ...
# connect con1;
# reap;
# connection default;
# disconnect con1;
# <end of test>
# and not only by appending include/wait_until_count_sessions.inc etc.
#
#
# EXAMPLE
#
# backup.test, grant3.test
#
#
# Created: 2009-01-14 mleich
#
let $wait_counter= 50;
if ($wait_timeout)
{
let $wait_counter= `SELECT $wait_timeout * 10`;
}
# Reset $wait_timeout so that its value won't be used on subsequent
# calls, and default will be used instead.
let $wait_timeout= 0;
while ($wait_counter)
{
let $current_sessions= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1);
let $success= `SELECT $current_sessions = $count_sessions`;
if ($success)
{
let $wait_counter= 0;
}
if (!$success)
{
real_sleep 0.1;
dec $wait_counter;
}
}
if (!$success)
{
--echo # Timeout in wait_until_count_sessions.inc
--echo # Number of sessions expected: $count_sessions found: $current_sessions
}
......@@ -319,4 +319,9 @@ select @my_uuid_date - @my_uuid_synthetic;
@my_uuid_date - @my_uuid_synthetic
0
set @@session.time_zone=@save_tz;
CREATE TABLE t1 (a DATE);
SELECT * FROM t1 WHERE a = NAME_CONST('reportDate',
_binary'2009-01-09' COLLATE 'binary');
a
DROP TABLE t1;
End of 5.0 tests
......@@ -366,20 +366,20 @@ insert into mysql.user select * from t1;
drop table t1, t2;
drop database TESTDB;
flush privileges;
grant all privileges on test.* to `a@`@localhost;
grant execute on * to `a@`@localhost;
create table t2 (s1 int);
insert into t2 values (1);
drop function if exists f2;
create function f2 () returns int begin declare v int; select s1 from t2
into v; return v; end//
select f2();
GRANT ALL PRIVILEGES ON test.* TO `a@`@localhost;
GRANT EXECUTE ON * TO `a@`@localhost;
CREATE TABLE t2 (s1 INT);
INSERT INTO t2 VALUES (1);
DROP FUNCTION IF EXISTS f2;
CREATE FUNCTION f2 () RETURNS INT
BEGIN DECLARE v INT; SELECT s1 FROM t2 INTO v; RETURN v; END//
SELECT f2();
f2()
1
drop function f2;
drop table t2;
DROP FUNCTION f2;
DROP TABLE t2;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost;
drop user `a@`@localhost;
DROP USER `a@`@localhost;
drop database if exists mysqltest_1;
drop database if exists mysqltest_2;
drop user mysqltest_u1@localhost;
......@@ -436,6 +436,7 @@ SELECT * FROM t2;
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2'
SELECT * FROM t1 JOIN t2 USING (b);
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2'
USE test;
DROP TABLE db1.t1, db1.t2;
DROP USER mysqltest1@localhost;
DROP DATABASE db1;
......
drop table if exists t1;
create table t1(a int) engine=innodb;
lock tables t1 write;
insert into t1 values(10);
select * from t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT) ENGINE=innodb;
LOCK TABLES t1 WRITE;
INSERT INTO t1 VALUES(10);
SELECT * FROM t1;
a
10
drop table t1;
DROP TABLE t1;
......@@ -940,4 +940,15 @@ m1 CREATE TABLE `m1` (
`a` int(11) default NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1, m1;
CREATE TABLE t1(a INT);
CREATE TABLE t2(a VARCHAR(10));
CREATE TABLE m1(a INT) ENGINE=MERGE UNION=(t1, t2);
CREATE TABLE m2(a INT) ENGINE=MERGE UNION=(t1);
SELECT * FROM t1;
a
SELECT * FROM m1;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
SELECT * FROM m2;
a
DROP TABLE t1, t2, m1, m2;
End of 5.0 tests
Bug#37938 - Test "mysqldump" lacks various insert statements
Turn off concurrent inserts to avoid random errors
NOTE: We reset the variable back to saved value at the end of test
# Bug#37938 Test "mysqldump" lacks various insert statements
# Turn off concurrent inserts to avoid random errors
# NOTE: We reset the variable back to saved value at the end of test
SET @OLD_CONCURRENT_INSERT = @@GLOBAL.CONCURRENT_INSERT;
SET @@GLOBAL.CONCURRENT_INSERT = 0;
DROP TABLE IF EXISTS t1, `"t"1`, t1aa, t2, t2aa, t3;
......@@ -8,7 +8,7 @@ drop database if exists mysqldump_test_db;
drop database if exists db1;
drop database if exists db2;
drop view if exists v1, v2, v3;
CREATE TABLE t1(a int);
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1), (2);
<?xml version="1.0"?>
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
......@@ -28,7 +28,7 @@ INSERT INTO t1 VALUES (1), (2);
</mysqldump>
DROP TABLE t1;
#
# Bug #2005
# Bug#2005 Long decimal comparison bug.
#
CREATE TABLE t1 (a decimal(64, 20));
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
......@@ -42,7 +42,7 @@ SET character_set_client = @saved_cs_client;
INSERT INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('987654321098765432109876543210987654321.00000000000000000000');
DROP TABLE t1;
#
# Bug #2055
# Bug#2055 mysqldump should replace "-inf" numeric field values with "NULL"
#
CREATE TABLE t1 (a double);
INSERT INTO t1 VALUES ('-9e999999');
......@@ -57,7 +57,7 @@ SET character_set_client = @saved_cs_client;
INSERT INTO `t1` VALUES (RES);
DROP TABLE t1;
#
# Bug #3361 mysqldump quotes DECIMAL values inconsistently
# Bug#3361 mysqldump quotes DECIMAL values inconsistently
#
CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT);
INSERT INTO t1 VALUES (1.2345, 2.3456);
......@@ -169,7 +169,7 @@ INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES");
</mysqldump>
DROP TABLE t1;
#
# Bug #1707
# Bug#1707 mysqldump -X does't quote field and table names
#
CREATE TABLE t1 (`a"b"` char(2));
INSERT INTO t1 VALUES ("1\""), ("\"2");
......@@ -191,8 +191,8 @@ INSERT INTO t1 VALUES ("1\""), ("\"2");
</mysqldump>
DROP TABLE t1;
#
# Bug #1994
# Bug #4261
# Bug#1994 mysqldump does not correctly dump UCS2 data
# Bug#4261 mysqldump 10.7 (mysql 4.1.2) --skip-extended-insert drops NULL from inserts
#
CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL);
......@@ -233,7 +233,7 @@ UNLOCK TABLES;
DROP TABLE t1;
#
# Bug #2634
# Bug#2634 mysqldump in --compatible=mysql4
#
CREATE TABLE t1 (a int) ENGINE=MYISAM;
INSERT INTO t1 VALUES (1), (2);
......@@ -291,7 +291,7 @@ UNLOCK TABLES;
DROP TABLE t1;
#
# Bug #2592 'mysqldump doesn't quote "tricky" names correctly'
# Bug#2592 mysqldump doesn't quote "tricky" names correctly
#
create table ```a` (i int);
SET @saved_cs_client = @@character_set_client;
......@@ -302,7 +302,7 @@ CREATE TABLE ```a` (
SET character_set_client = @saved_cs_client;
drop table ```a`;
#
# Bug #2591 "mysqldump quotes names inconsistently"
# Bug#2591 mysqldump quotes names inconsistently
#
create table t1(a int);
......@@ -425,7 +425,7 @@ UNLOCK TABLES;
set global sql_mode='';
drop table t1;
#
# Bug #2705 'mysqldump --tab extra output'
# Bug#2705 mysqldump --tab extra output
#
create table t1(a int);
insert into t1 values (1),(2),(3);
......@@ -459,7 +459,7 @@ SET character_set_client = @saved_cs_client;
3
drop table t1;
#
# Bug #6101: create database problem
# Bug#6101 create database problem
#
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
......@@ -514,7 +514,7 @@ USE `mysqldump_test_db`;
drop database mysqldump_test_db;
#
# Bug #7020
# Bug#7020 mysqldump --compatible=mysql40 should set --skip-set-charset --default-char...
# Check that we don't dump in UTF8 in compatible mode by default,
# but use the default compiled values, or the values given in
# --default-character-set=xxx. However, we should dump in UTF8
......@@ -556,8 +556,8 @@ UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
#
# Bug#8063: make test mysqldump [ fail ]
# We cannot tes this command because its output depends
# Bug#8063 make test mysqldump [ fail ]
# We cannot test this command because its output depends
# on --default-character-set incompiled into "mysqldump" program.
# If the future we can move this command into a separate test with
# checking that "mysqldump" is compiled with "latin1"
......@@ -642,7 +642,7 @@ UNLOCK TABLES;
DROP TABLE t1;
#
# WL #2319: Exclude Tables from dump
# WL#2319 Exclude Tables from dump
#
CREATE TABLE t1 (a int);
CREATE TABLE t2 (a int);
......@@ -685,7 +685,7 @@ UNLOCK TABLES;
DROP TABLE t1;
DROP TABLE t2;
#
# Bug #8830
# Bug#8830 mysqldump --skip-extended-insert causes --hex-blob to dump wrong values
#
CREATE TABLE t1 (`b` blob);
INSERT INTO `t1` VALUES (0x602010000280100005E71A);
......@@ -727,7 +727,7 @@ DROP TABLE t1;
#
# Test for --insert-ignore
#
CREATE TABLE t1 (a int);
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
INSERT INTO t1 VALUES (4),(5),(6);
......@@ -798,9 +798,9 @@ INSERT DELAYED IGNORE INTO `t1` VALUES (1),(2),(3),(4),(5),(6);
DROP TABLE t1;
#
# Bug #10286: mysqldump -c crashes on table that has many fields with long
# names
#
# Bug#10286 mysqldump -c crashes on table that has many fields with long
# names
#
create table t1 (
F_c4ca4238a0b923820dcc509a6f75849b int,
F_c81e728d9d4c2f636f067f89cc14862c int,
......@@ -1544,7 +1544,7 @@ UNLOCK TABLES;
DROP TABLE t1;
#
# Bug #9558 mysqldump --no-data db t1 t2 format still dumps data
# Bug#9558 mysqldump --no-data db t1 t2 format still dumps data
#
CREATE DATABASE mysqldump_test_db;
USE mysqldump_test_db;
......@@ -1649,7 +1649,7 @@ DROP DATABASE mysqldump_test_db;
#
# Testing with tables and databases that don't exists
# or contains illegal characters
# (Bug #9358 mysqldump crashes if tablename starts with \)
# (Bug#9358 mysqldump crashes if tablename starts with \)
#
create database mysqldump_test_db;
use mysqldump_test_db;
......@@ -1678,7 +1678,7 @@ drop table t1, t2, t3;
drop database mysqldump_test_db;
use test;
#
# Bug #9657 mysqldump xml ( -x ) does not format NULL fields correctly
# Bug#9657 mysqldump xml ( -x ) does not format NULL fields correctly
#
create table t1 (a int(10));
create table t2 (pk int primary key auto_increment,
......@@ -1737,7 +1737,7 @@ insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thir
</mysqldump>
drop table t1, t2;
#
# BUG #12123
# Bug#12123 mysqldump --tab results in text file which can't be imported
#
create table t1 (a text character set utf8, b text character set latin1);
insert t1 values (0x4F736E616272C3BC636B, 0x4BF66C6E);
......@@ -1750,11 +1750,11 @@ a b
Osnabrck Kln
drop table t1;
#
# BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence
# Bug#15328 Segmentation fault occured if my.cnf is invalid for escape sequence
#
--fields-optionally-enclosed-by="
#
# BUG #19025 mysqldump doesn't correctly dump "auto_increment = [int]"
# Bug#19025 mysqldump doesn't correctly dump "auto_increment = [int]"
#
create table `t1` (
t1_name varchar(255) default null,
......@@ -1794,7 +1794,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1
drop table `t1`;
#
# Bug #18536: wrong table order
# Bug#18536 wrong table order
#
create table t1(a int);
create table t2(a int);
......@@ -1843,7 +1843,7 @@ SET character_set_client = @saved_cs_client;
drop table t1, t2, t3;
#
# Bug #21288: mysqldump segmentation fault when using --where
# Bug#21288 mysqldump segmentation fault when using --where
#
create table t1 (a int);
mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ * FROM `t1` WHERE xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': 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 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 (1064)
......@@ -1879,7 +1879,7 @@ SET character_set_client = @saved_cs_client;
drop table t1;
#
# BUG#13926: --order-by-primary fails if PKEY contains quote character
# Bug#13926 --order-by-primary fails if PKEY contains quote character
#
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
......@@ -1958,7 +1958,7 @@ UNLOCK TABLES;
DROP TABLE `t1`;
End of 4.1 tests
#
# Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X)
# Bug#10213 mysqldump crashes when dumping VIEWs(on MacOS X)
#
create database db1;
use db1;
......@@ -2023,7 +2023,7 @@ drop view v2;
drop database db1;
use test;
#
# Bug 10713 mysqldump includes database in create view and referenced tables
# Bug#10713 mysqldump includes database in create view and referenced tables
#
create database db2;
use db2;
......@@ -2102,7 +2102,7 @@ DROP TABLE IF EXISTS `v1`;
drop view v1;
drop table t1;
#
# Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X)
# Bug#10213 mysqldump crashes when dumping VIEWs(on MacOS X)
#
create database mysqldump_test_db;
use mysqldump_test_db;
......@@ -2167,7 +2167,7 @@ drop view v2;
drop database mysqldump_test_db;
use test;
#
# Bug #9756
# Bug#9756 mysql client failing on dumps containing certain \ sequences
#
CREATE TABLE t1 (a char(10));
INSERT INTO t1 VALUES ('\'');
......@@ -2207,7 +2207,7 @@ UNLOCK TABLES;
DROP TABLE t1;
#
# Bug #10927 mysqldump: Can't reload dump with view that consist of other view
# Bug#10927 mysqldump: Can't reload dump with view that consist of other view
#
create table t1(a int, b int, c varchar(30));
insert into t1 values(1, 2, "one"), (2, 4, "two"), (3, 6, "three");
......@@ -2505,12 +2505,14 @@ end if;
end BEFORE # STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER root@localhost
DROP TABLE t1, t2;
#
# Bugs #9136, #12917: problems with --defaults-extra-file option
# Bug#9136 my_print_defaults changed behaviour between 4.1.7 and 4.1.10a
# Bug#12917 The --defaults-extra-file option is ignored by the 5.0 client binaries
# (Problems with --defaults-extra-file option)
#
--port=1234
--port=1234
#
# Test of fix to BUG 12597
# Test of fix to Bug#12597 mysqldump dumps triggers wrongly
#
DROP TABLE IF EXISTS `test1`;
Warnings:
......@@ -2544,7 +2546,7 @@ DROP TRIGGER testref;
DROP TABLE test1;
DROP TABLE test2;
#
# BUG#9056 - mysqldump does not dump routines
# Bug#9056 mysqldump does not dump routines
#
DROP TABLE IF EXISTS t1;
DROP FUNCTION IF EXISTS bug9056_func1;
......@@ -2562,9 +2564,9 @@ begin
set f1= concat( 'hello', f1 );
return f1;
end //
CREATE PROCEDURE bug9056_proc2(OUT a INT)
BEGIN
select sum(id) from t1 into a;
CREATE PROCEDURE bug9056_proc2(OUT a INT)
BEGIN
select sum(id) from t1 into a;
END //
set sql_mode='ansi';
create procedure `a'b` () select 1;
......@@ -2624,8 +2626,8 @@ BEGIN SELECT a+b INTO c; end */;;
/*!50003 DROP PROCEDURE IF EXISTS `bug9056_proc2` */;;
/*!50003 SET SESSION SQL_MODE=""*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `bug9056_proc2`(OUT a INT)
BEGIN
select sum(id) from t1 into a;
BEGIN
select sum(id) from t1 into a;
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
DELIMITER ;
......@@ -2646,7 +2648,7 @@ DROP PROCEDURE bug9056_proc2;
DROP PROCEDURE `a'b`;
drop table t1;
#
# BUG# 13052 - mysqldump timestamp reloads broken
# Bug#13052 mysqldump timestamp reloads broken
#
drop table if exists t1;
create table t1 (`d` timestamp, unique (`d`));
......@@ -2741,7 +2743,7 @@ drop table t1;
set global time_zone=default;
set time_zone=default;
#
# Test of fix to BUG 13146 - ansi quotes break loading of triggers
# Test of fix to Bug#13146 ansi quotes break loading of triggers
#
DROP TABLE IF EXISTS `t1 test`;
DROP TABLE IF EXISTS `t2 test`;
......@@ -2814,7 +2816,7 @@ DROP TRIGGER `test trig`;
DROP TABLE `t1 test`;
DROP TABLE `t2 test`;
#
# BUG# 12838 mysqldump -x with views exits with error
# Bug#12838 mysqldump -x with views exits with error
#
drop table if exists t1;
create table t1 (a int, b varchar(32), c varchar(32));
......@@ -2912,7 +2914,7 @@ drop view v0;
drop view v1;
drop table t1;
#
# BUG#14554 - mysqldump does not separate words "ROW" and "BEGIN"
# Bug#14554 mysqldump does not separate words "ROW" and "BEGIN"
# for tables with trigger created in the IGNORE_SPACE sql mode.
#
SET @old_sql_mode = @@SQL_MODE;
......@@ -2975,8 +2977,8 @@ DELIMITER ;
DROP TRIGGER tr1;
DROP TABLE t1;
#
# Bug #13318: Bad result with empty field and --hex-blob
#
# Bug#13318 Bad result with empty field and --hex-blob
#
create table t1 (a binary(1), b blob);
insert into t1 values ('','');
......@@ -3051,7 +3053,7 @@ UNLOCK TABLES;
drop table t1;
#
# Bug 14871 Invalid view dump output
# Bug#14871 Invalid view dump output
#
create table t1 (a int);
insert into t1 values (289), (298), (234), (456), (789);
......@@ -3080,7 +3082,7 @@ a
drop table t1;
drop view v1, v2, v3, v4, v5;
#
# Bug #16878 dump of trigger
# Bug#16878 dump of trigger
#
create table t1 (a int, created datetime);
create table t2 (b int, created datetime);
......@@ -3130,7 +3132,7 @@ drop view v2;
drop table t;
#
# Bug#14857 Reading dump files with single statement stored routines fails.
# fixed by patch for bug#16878
# fixed by patch for Bug#16878
#
/*!50003 CREATE FUNCTION `f`() RETURNS bigint(20)
return 42 */|
......@@ -3147,7 +3149,7 @@ select 42
drop function f;
drop procedure p;
#
# Bug #17371 Unable to dump a schema with invalid views
# Bug#17371 Unable to dump a schema with invalid views
#
create table t1 ( id serial );
create view v1 as select * from t1;
......@@ -3158,7 +3160,7 @@ mysqldump {
} mysqldump
drop view v1;
# BUG#17201 Spurious 'DROP DATABASE' in output,
# Bug#17201 Spurious 'DROP DATABASE' in output,
# also confusion between tables and views.
# Example code from Markus Popp
create database mysqldump_test_db;
......@@ -3225,7 +3227,7 @@ drop view v1;
drop table t1;
drop database mysqldump_test_db;
#
# Bug21014 Segmentation fault of mysqldump on view
# Bug#21014 Segmentation fault of mysqldump on view
#
create database mysqldump_tables;
use mysqldump_tables;
......@@ -3265,7 +3267,7 @@ drop database mysqldump_views;
drop table mysqldump_tables.basetable;
drop database mysqldump_tables;
#
# Bug20221 Dumping of multiple databases containing view(s) yields maleformed dumps
# Bug#20221 Dumping of multiple databases containing view(s) yields maleformed dumps
#
create database mysqldump_dba;
use mysqldump_dba;
......@@ -3322,10 +3324,10 @@ SET character_set_client = @saved_cs_client;
drop table t1;
drop user mysqltest_1@localhost;
#
# Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the
# information_schema database.
# Bug#21527 mysqldump incorrectly tries to LOCK TABLES on the
# information_schema database.
#
# Bug #21424 mysqldump failing to export/import views
# Bug#21424 mysqldump failing to export/import views
#
create database mysqldump_myDB;
use mysqldump_myDB;
......@@ -3345,8 +3347,8 @@ revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
drop user myDB_User@localhost;
drop database mysqldump_myDB;
flush privileges;
# Bug #21424 continues from here.
# Restore. Flush Privileges test ends.
# Bug#21424 continues from here.
# Restore. Flush Privileges test ends.
#
use mysqldump_myDB;
select * from mysqldump_myDB.v1;
......@@ -3364,7 +3366,7 @@ drop user myDB_User@localhost;
drop database mysqldump_myDB;
use test;
#
# Bug #19745: mysqldump --xml produces invalid xml
# Bug#19745 mysqldump --xml produces invalid xml
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (f1 int(10), data MEDIUMBLOB);
......@@ -3386,15 +3388,15 @@ INSERT INTO t1 VALUES(1,0xff00fef0);
</mysqldump>
DROP TABLE t1;
#
# Bug#26346: stack + buffer overrun in mysqldump
# Bug#26346 stack + buffer overrun in mysqldump
#
CREATE TABLE t1(a int);
INSERT INTO t1 VALUES (1), (2);
mysqldump: Input filename too long: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
DROP TABLE t1;
CREATE TABLE t2 (a int);
CREATE TABLE t3 (a int);
CREATE TABLE t1 (a int) ENGINE=merge UNION=(t2, t3);
CREATE TABLE t2 (a INT);
CREATE TABLE t3 (a INT);
CREATE TABLE t1 (a INT) ENGINE=merge UNION=(t2, t3);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
......@@ -3449,7 +3451,7 @@ UNLOCK TABLES;
DROP TABLE t1, t2, t3;
#
# Bug #23491: MySQLDump prefix function call in a view by database name
# Bug#23491 MySQLDump prefix function call in a view by database name
#
create database bug23491_original;
create database bug23491_restore;
......@@ -3471,12 +3473,12 @@ v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI
drop database bug23491_original;
drop database bug23491_restore;
use test;
#
# Bug 27293: mysqldump crashes when dumping routines
# defined by a different user
#
# Bug #22761: mysqldump reports no errors when using
# --routines without mysql.proc privileges
# Bug#27293 mysqldump crashes when dumping routines
# defined by a different user
#
# Bug#22761 mysqldump reports no errors when using
# --routines without mysql.proc privileges
#
create database mysqldump_test_db;
grant all privileges on mysqldump_test_db.* to user1;
......@@ -3503,7 +3505,7 @@ drop user user1;
drop user user2;
drop database mysqldump_test_db;
#
# Bug #28522: buffer overrun by '\0' byte using --hex-blob.
# Bug#28522 buffer overrun by '\0' byte using --hex-blob.
#
CREATE TABLE t1 (c1 INT, c2 LONGBLOB);
INSERT INTO t1 SET c1=11, c2=REPEAT('q',509);
......@@ -3517,8 +3519,8 @@ SET character_set_client = @saved_cs_client;
INSERT INTO `t1` VALUES (11,0x7171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171);
DROP TABLE t1;
#
# Bug #28524: mysqldump --skip-add-drop-table is not
# compatible with views
# Bug#28524 mysqldump --skip-add-drop-table is not
# compatible with views
#
CREATE VIEW v1 AS SELECT 1;
DROP VIEW v1;
......@@ -3527,8 +3529,8 @@ SELECT * FROM v1;
1
DROP VIEW v1;
#
# Bug #29788: mysqldump discards the NO_AUTO_VALUE_ON_ZERO value of
# the SQL_MODE variable after the dumping of triggers.
# Bug#29788 mysqldump discards the NO_AUTO_VALUE_ON_ZERO value of
# the SQL_MODE variable after the dumping of triggers.
#
CREATE TABLE t1 (c1 INT);
CREATE TRIGGER t1bd BEFORE DELETE ON t1 FOR EACH ROW BEGIN END;
......@@ -3549,8 +3551,8 @@ c1
2
DROP TABLE t1,t2;
#
# Bug#29815: new option for suppressing last line of mysqldump:
# "Dump completed on"
# Bug#29815 new option for suppressing last line of mysqldump:
# "Dump completed on"
#
# --skip-dump-date:
--
......
......@@ -436,5 +436,14 @@ select @my_uuid_date - @my_uuid_synthetic;
set @@session.time_zone=@save_tz;
#
# Bug#42014: Crash, name_const with collate
#
CREATE TABLE t1 (a DATE);
SELECT * FROM t1 WHERE a = NAME_CONST('reportDate',
_binary'2009-01-09' COLLATE 'binary');
DROP TABLE t1;
--echo End of 5.0 tests
# Grant tests not performed with embedded server
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
SET NAMES binary;
#
......@@ -27,7 +31,7 @@ create user mysqltest_2@localhost;
connect (user_a,localhost,mysqltest_1,,);
connection user_a;
grant select on `my\_1`.* to mysqltest_2@localhost;
--error 1132
--error ER_PASSWORD_NOT_ALLOWED
grant select on `my\_1`.* to mysqltest_2@localhost identified by 'pass';
disconnect user_a;
connection default;
......@@ -61,7 +65,7 @@ connect (user1,localhost,mysqltest_1,,);
connection user1;
select current_user();
grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option;
--error 1044
--error ER_DBACCESS_DENIED_ERROR
grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option;
#
......@@ -72,7 +76,7 @@ select @@sql_mode;
#
# GRANT without IDENTIFIED BY does not create new users
#
--error 1133
--error ER_PASSWORD_NO_MATCH
grant select on `my\_1`.* to mysqltest_4@localhost with grant option;
grant select on `my\_1`.* to mysqltest_4@localhost identified by 'mypass'
with grant option;
......@@ -80,7 +84,7 @@ disconnect user1;
connection default;
show grants for mysqltest_1@localhost;
show grants for mysqltest_2@localhost;
--error 1141
--error ER_NONEXISTING_GRANT
show grants for mysqltest_3@localhost;
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
......@@ -95,7 +99,7 @@ connect (user2,localhost,mysqltest_1,,);
connection user2;
select current_user();
show databases;
--error 1044
--error ER_DBACCESS_DENIED_ERROR
grant all privileges on `mysqltest_1`.* to mysqltest_1@localhost with grant option;
disconnect user2;
connection default;
......@@ -106,8 +110,8 @@ drop database mysqltest_1;
flush privileges;
#
# Bug #6173: One can circumvent missing UPDATE privilege if he has SELECT
# and INSERT privilege for table with primary key
# Bug#6173 One can circumvent missing UPDATE privilege if he has SELECT and
# INSERT privilege for table with primary key
#
create database mysqltest;
grant INSERT, SELECT on mysqltest.* to mysqltest_1@localhost;
......@@ -119,10 +123,10 @@ connect (mrbad, localhost, mysqltest_1,,mysqltest);
connection mrbad;
show grants for current_user();
insert into t1 values (1, 'I can''t change it!');
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
update t1 set data='I can change it!' where id = 1;
# This should not be allowed since it too require UPDATE privilege.
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
insert into t1 values (1, 'XXX') on duplicate key update data= 'I can change it!';
select * from t1;
disconnect mrbad;
......@@ -138,9 +142,9 @@ create table t1 (a int, b int);
grant select (a) on t1 to mysqltest_1@localhost with grant option;
connect (mrugly, localhost, mysqltest_1,,mysqltest);
connection mrugly;
--error 1143
--error ER_COLUMNACCESS_DENIED_ERROR
grant select (a,b) on t1 to mysqltest_2@localhost;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
grant select on t1 to mysqltest_3@localhost;
disconnect mrugly;
......@@ -157,7 +161,7 @@ use test;
#
# Bug #15775: "drop user" command does not refresh acl_check_hosts
# Bug#15775 "drop user" command does not refresh acl_check_hosts
#
# Create some test users
......@@ -188,15 +192,15 @@ disconnect con9;
connection default;
#
# Bug# 16180 - Setting SQL_LOG_OFF without SUPER privilege is silently ignored
# Bug#16180 Setting SQL_LOG_OFF without SUPER privilege is silently ignored
#
create database mysqltest_1;
grant select, insert, update on `mysqltest\_1`.* to mysqltest_1@localhost;
connect (con10,localhost,mysqltest_1,,);
connection con10;
--error 1227
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
set sql_log_off = 1;
--error 1227
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
set sql_log_bin = 0;
disconnect con10;
connection default;
......@@ -217,7 +221,7 @@ create table t2(c1 int, c2 int);
#
# Three forms of CREATE USER
create user 'mysqltest_1';
--error 1396
--error ER_CANNOT_USER
create user 'mysqltest_1';
create user 'mysqltest_2' identified by 'Mysqltest-2';
create user 'mysqltest_3' identified by password 'fffffffffffffffffffffffffffffffffffffffff';
......@@ -238,7 +242,7 @@ select host,user,password from mysql.user where user like 'mysqltest_%' order by
select host,db,user from mysql.db where user like 'mysqltest_%' order by host,db,user;
select host,db,user,table_name from mysql.tables_priv where user like 'mysqltest_%' order by host,db,user,table_name;
select host,db,user,table_name,column_name from mysql.columns_priv where user like 'mysqltest_%' order by host,db,user,table_name,column_name;
--error 1141
--error ER_NONEXISTING_GRANT
show grants for 'mysqltest_1';
#
# Rename
......@@ -249,7 +253,7 @@ select host,db,user,table_name from mysql.tables_priv where user like 'mysqltest
select host,db,user,table_name,column_name from mysql.columns_priv where user like 'mysqltest_%' order by host,db,user,table_name,column_name;
show grants for 'mysqltest_1';
drop user 'mysqltest_1', 'mysqltest_3';
--error 1396
--error ER_CANNOT_USER
drop user 'mysqltest_1';
#
# Cleanup
......@@ -258,9 +262,9 @@ drop table t1, t2;
# Add a stray record
insert into mysql.db set user='mysqltest_1', db='%', host='%';
flush privileges;
--error 1141
--error ER_NONEXISTING_GRANT
show grants for 'mysqltest_1';
--error 1269
--error ER_REVOKE_GRANTS
revoke all privileges, grant option from 'mysqltest_1';
drop user 'mysqltest_1';
select host,db,user from mysql.db where user = 'mysqltest_1' order by host,db,user;
......@@ -268,7 +272,7 @@ select host,db,user from mysql.db where user = 'mysqltest_1' order by host,db,us
# Add a stray record
insert into mysql.tables_priv set host='%', db='test', user='mysqltest_1', table_name='t1';
flush privileges;
--error 1141
--error ER_NONEXISTING_GRANT
show grants for 'mysqltest_1';
drop user 'mysqltest_1';
select host,db,user,table_name from mysql.tables_priv where user = 'mysqltest_1' order by host,db,user,table_name;
......@@ -276,7 +280,7 @@ select host,db,user,table_name from mysql.tables_priv where user = 'mysqltest_1'
# Add a stray record
insert into mysql.columns_priv set host='%', db='test', user='mysqltest_1', table_name='t1', column_name='c1';
flush privileges;
--error 1141
--error ER_NONEXISTING_GRANT
show grants for 'mysqltest_1';
drop user 'mysqltest_1';
select host,db,user,table_name,column_name from mysql.columns_priv where user = 'mysqltest_1' order by host,db,user,table_name,column_name;
......@@ -286,23 +290,23 @@ create user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3';
drop user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3';
create user 'mysqltest_1', 'mysqltest_2' identified by 'Mysqltest-2', 'mysqltest_3' identified by password 'fffffffffffffffffffffffffffffffffffffffff';
rename user 'mysqltest_1' to 'mysqltest_1a', 'mysqltest_2' TO 'mysqltest_2a', 'mysqltest_3' TO 'mysqltest_3a';
--error 1396
--error ER_CANNOT_USER
drop user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3';
drop user 'mysqltest_1a', 'mysqltest_2a', 'mysqltest_3a';
#
# Let one of multiple users fail
create user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3';
--error 1396
--error ER_CANNOT_USER
create user 'mysqltest_1a', 'mysqltest_2', 'mysqltest_3a';
--error 1396
--error ER_CANNOT_USER
rename user 'mysqltest_1a' to 'mysqltest_1b', 'mysqltest_2a' TO 'mysqltest_2b', 'mysqltest_3a' TO 'mysqltest_3b';
drop user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3';
--error 1396
--error ER_CANNOT_USER
drop user 'mysqltest_1b', 'mysqltest_2b', 'mysqltest_3b';
#
# Obsolete syntax has been dropped
create user 'mysqltest_2' identified by 'Mysqltest-2';
--error 1064
--error ER_PARSE_ERROR
drop user 'mysqltest_2' identified by 'Mysqltest-2';
drop user 'mysqltest_2';
#
......@@ -312,7 +316,7 @@ show grants for '%@b'@'b';
grant select on mysql.* to '%@b'@'b';
show grants for '%@b'@'b';
rename user '%@b'@'b' to '%@a'@'a';
--error 1141
--error ER_NONEXISTING_GRANT
show grants for '%@b'@'b';
show grants for '%@a'@'a';
drop user '%@a'@'a';
......@@ -323,7 +327,7 @@ create user mysqltest_2@localhost;
grant create user on *.* to mysqltest_2@localhost;
connect (user3,localhost,mysqltest_2,,);
connection user3;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
select host,user,password from mysql.user where user like 'mysqltest_%' order by host,user,password;
create user mysqltest_A@'%';
rename user mysqltest_A@'%' to mysqltest_B@'%';
......@@ -338,7 +342,7 @@ grant INSERT,DELETE,UPDATE on mysql.* to mysqltest_3@localhost;
connect (user4,localhost,mysqltest_3,,);
connection user4;
show grants;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
select host,user,password from mysql.user where user like 'mysqltest_%' order by host,user,password;
insert into mysql.user set host='%', user='mysqltest_B';
create user mysqltest_A@'%';
......@@ -349,7 +353,7 @@ disconnect user4;
connection default;
drop user mysqltest_3@localhost;
#
# Bug #3309: Test IP addresses with netmask
# Bug#3309 Test IP addresses with netmask
set @@sql_mode='';
create database mysqltest_1;
create table mysqltest_1.t1 (i int);
......@@ -367,7 +371,8 @@ flush privileges;
drop table mysqltest_1.t1;
#
# Bug #12302: 'SET PASSWORD = ...' didn't work if connecting hostname !=
# Bug#12302 Hostname resolution preventing password changes
# 'SET PASSWORD = ...' didn't work if connecting hostname !=
# hostname the current user is authenticated as. Note that a test for this
# was also added to the test above.
#
......@@ -400,7 +405,7 @@ drop database mysqltest_1;
# But anonymous users can't change their password
connect (n5,localhost,test,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection n5;
--error 1044
--error ER_DBACCESS_DENIED_ERROR
set password = password("changed");
disconnect n5;
connection default;
......@@ -408,7 +413,7 @@ connection default;
--source include/delete_anonymous_users.inc
# Bug #12423 "Deadlock when doing FLUSH PRIVILEGES and GRANT in
# Bug#12423 "Deadlock when doing FLUSH PRIVILEGES and GRANT in
# multi-threaded environment". We should be able to execute FLUSH
# PRIVILEGES and SET PASSWORD simultaneously with other account
# management commands (such as GRANT and REVOKE) without causing
......@@ -474,12 +479,13 @@ connect (con1,localhost,mysqltest_1,password,TESTDB);
# The user mysqltest_1 should only be allowed access to
# database TESTDB, not TEStdb
# On system with "lowercase names" we get error "1007: Can't create db..."
--error 1044, 1007
# On system with "lowercase names" we get error "ER_DB_CREATE_EXISTS: Can't create db..."
--error ER_DBACCESS_DENIED_ERROR, ER_DB_CREATE_EXISTS
create database TEStdb;
# Clean-up
connection default;
disconnect con1;
delete from mysql.user;
delete from mysql.db where host='%' and user='mysqltest_1' and db='TESTDB';
insert into mysql.user select * from t1;
......@@ -488,35 +494,34 @@ drop database TESTDB;
flush privileges;
#
# BUG#13310 incorrect user parsing by SP
# Bug#13310 incorrect user parsing by SP
#
grant all privileges on test.* to `a@`@localhost;
grant execute on * to `a@`@localhost;
GRANT ALL PRIVILEGES ON test.* TO `a@`@localhost;
GRANT EXECUTE ON * TO `a@`@localhost;
connect (bug13310,localhost,'a@',,test);
connection bug13310;
create table t2 (s1 int);
insert into t2 values (1);
CREATE TABLE t2 (s1 INT);
INSERT INTO t2 VALUES (1);
--disable_warnings
drop function if exists f2;
DROP FUNCTION IF EXISTS f2;
--enable_warnings
delimiter //;
create function f2 () returns int begin declare v int; select s1 from t2
into v; return v; end//
CREATE FUNCTION f2 () RETURNS INT
BEGIN DECLARE v INT; SELECT s1 FROM t2 INTO v; RETURN v; END//
delimiter ;//
select f2();
SELECT f2();
drop function f2;
drop table t2;
DROP FUNCTION f2;
DROP TABLE t2;
disconnect bug13310;
connection default;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost;
drop user `a@`@localhost;
DROP USER `a@`@localhost;
#
# Bug#25578 "CREATE TABLE LIKE does not require any privileges on source table"
# Bug#25578 CREATE TABLE LIKE does not require any privileges on source table
#
--disable_warnings
drop database if exists mysqltest_1;
......@@ -535,7 +540,7 @@ create table t1 (i int);
connect (user1,localhost,mysqltest_u1,,mysqltest_1);
connection user1;
# As expected error is emitted
--error ER_TABLEACCESS_DENIED_ERROR
--error ER_TABLEACCESS_DENIED_ERROR
show create table mysqltest_2.t1;
# This should emit error as well
--error ER_TABLEACCESS_DENIED_ERROR
......@@ -550,14 +555,16 @@ create table t1 like mysqltest_2.t1;
# Clean-up
connection default;
disconnect user1;
use test;
drop database mysqltest_1;
drop database mysqltest_2;
drop user mysqltest_u1@localhost;
#
# Bug#18660 Can't grant any privileges on single table in database
# with underscore char
# with underscore char
#
grant all on `mysqltest\_%`.* to mysqltest_1@localhost with grant option;
grant usage on *.* to mysqltest_2@localhost;
......@@ -571,7 +578,7 @@ grant create on `mysqltest\_1`.* to mysqltest_2@localhost;
grant select on mysqltest_1.t1 to mysqltest_2@localhost;
connect (con3,localhost,mysqltest_2,,);
connection con3;
--error 1044
--error ER_DBACCESS_DENIED_ERROR
create database mysqltest_3;
use mysqltest_1;
create table t2(f1 int);
......@@ -579,6 +586,9 @@ select * from t1;
connection default;
drop database mysqltest_1;
connection default;
disconnect con3;
disconnect con18600_1;
revoke all privileges, grant option from mysqltest_1@localhost;
revoke all privileges, grant option from mysqltest_2@localhost;
drop user mysqltest_1@localhost;
......@@ -586,7 +596,7 @@ drop user mysqltest_2@localhost;
#
# Bug #30468: column level privileges not respected when joining tables
# Bug#30468 column level privileges not respected when joining tables
#
CREATE DATABASE db1;
......@@ -597,7 +607,7 @@ INSERT INTO t1 VALUES (1,1),(2,2);
CREATE TABLE t2 (b INT, c INT);
INSERT INTO t2 VALUES (1,100),(2,200);
GRANT SELECT ON t1 TO mysqltest1@localhost;
GRANT SELECT ON t1 TO mysqltest1@localhost;
GRANT SELECT (b) ON t2 TO mysqltest1@localhost;
connect (conn1,localhost,mysqltest1,,);
......@@ -612,6 +622,7 @@ SELECT * FROM t1 JOIN t2 USING (b);
connection default;
disconnect conn1;
USE test;
DROP TABLE db1.t1, db1.t2;
DROP USER mysqltest1@localhost;
DROP DATABASE db1;
......@@ -619,3 +630,5 @@ DROP DATABASE db1;
--echo End of 5.0 tests
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
# Can't run with embedded server
# Can't run with embedded server because we use GRANT
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# Test of GRANT commands
SET NAMES binary;
......@@ -23,10 +27,11 @@ grant create user on *.* to mysqltest_1@localhost;
grant select on `my\_1`.* to mysqltest_1@localhost with grant option;
connect (user_a,localhost,mysqltest_1,,);
connection user_a;
--error 1410
--error ER_CANT_CREATE_USER_WITH_GRANT
grant select on `my\_1`.* to mysqltest_2@localhost;
create user mysqltest_2@localhost;
disconnect user_a;
disconnect master;
connection default;
delete from mysql.user where user like 'mysqltest\_%';
......@@ -36,7 +41,7 @@ delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges;
#
# Bug: #19828 Case sensitivity in Grant/Revoke
# Bug#19828 Case sensitivity in Grant/Revoke
#
grant select on test.* to CUser@localhost;
......@@ -137,7 +142,7 @@ DROP USER CUser2@LOCALHOST;
#
# Bug#31194: Privilege ordering does not order properly for wildcard values
# Bug#31194 Privilege ordering does not order properly for wildcard values
#
CREATE DATABASE mysqltest_1;
......@@ -160,3 +165,6 @@ DROP DATABASE mysqltest_1;
--echo End of 5.0 tests
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
# This is a test for bug 578
# Test for Bug#578 mysqlimport -l silently fails when binlog-ignore-db is set
-- source include/have_innodb.inc
--source include/have_innodb.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
--disable_warnings
drop table if exists t1;
create table t1(a int) engine=innodb;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT) ENGINE=innodb;
--enable_warnings
lock tables t1 write;
insert into t1 values(10);
LOCK TABLES t1 WRITE;
INSERT INTO t1 VALUES(10);
disconnect con1;
connection con2;
# The bug was that, because of the LOCK TABLES, the handler "forgot" to commit,
# and the other commit when we write to the binlog was not done because of
# binlog-ignore-db
select * from t1;
drop table t1;
# binlog-ignore-db
SELECT * FROM t1;
DROP TABLE t1;
connection default;
disconnect con2;
# End of 4.1 tests
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
......@@ -556,4 +556,17 @@ ALTER TABLE m1 UNION=();
SHOW CREATE TABLE m1;
DROP TABLE t1, m1;
#
# BUG#32047 - 'Spurious' errors while opening MERGE tables
#
CREATE TABLE t1(a INT);
CREATE TABLE t2(a VARCHAR(10));
CREATE TABLE m1(a INT) ENGINE=MERGE UNION=(t1, t2);
CREATE TABLE m2(a INT) ENGINE=MERGE UNION=(t1);
SELECT * FROM t1;
--error ER_WRONG_MRG_TABLE
SELECT * FROM m1;
SELECT * FROM m2;
DROP TABLE t1, t2, m1, m2;
--echo End of 5.0 tests
......@@ -5,10 +5,13 @@
# Binlog is required
--source include/have_log_bin.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--echo Bug#37938 - Test "mysqldump" lacks various insert statements
--echo Turn off concurrent inserts to avoid random errors
--echo NOTE: We reset the variable back to saved value at the end of test
--echo # Bug#37938 Test "mysqldump" lacks various insert statements
--echo # Turn off concurrent inserts to avoid random errors
--echo # NOTE: We reset the variable back to saved value at the end of test
SET @OLD_CONCURRENT_INSERT = @@GLOBAL.CONCURRENT_INSERT;
SET @@GLOBAL.CONCURRENT_INSERT = 0;
......@@ -23,13 +26,13 @@ drop view if exists v1, v2, v3;
# XML output
CREATE TABLE t1(a int);
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1), (2);
--exec $MYSQL_DUMP --skip-create --skip-comments -X test t1
DROP TABLE t1;
--echo #
--echo # Bug #2005
--echo # Bug#2005 Long decimal comparison bug.
--echo #
CREATE TABLE t1 (a decimal(64, 20));
......@@ -39,7 +42,7 @@ INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
DROP TABLE t1;
--echo #
--echo # Bug #2055
--echo # Bug#2055 mysqldump should replace "-inf" numeric field values with "NULL"
--echo #
CREATE TABLE t1 (a double);
......@@ -51,7 +54,7 @@ INSERT INTO t1 VALUES ('-9e999999');
DROP TABLE t1;
--echo #
--echo # Bug #3361 mysqldump quotes DECIMAL values inconsistently
--echo # Bug#3361 mysqldump quotes DECIMAL values inconsistently
--echo #
CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT);
......@@ -65,7 +68,7 @@ INSERT INTO t1 VALUES ("1.2345", 2.3456);
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI_QUOTES';
INSERT INTO t1 VALUES (1.2345, 2.3456);
INSERT INTO t1 VALUES ('1.2345', 2.3456);
--error 1054
--error ER_BAD_FIELD_ERROR
INSERT INTO t1 VALUES ("1.2345", 2.3456);
SET SQL_MODE=@OLD_SQL_MODE;
......@@ -82,7 +85,7 @@ INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES");
DROP TABLE t1;
--echo #
--echo # Bug #1707
--echo # Bug#1707 mysqldump -X does't quote field and table names
--echo #
CREATE TABLE t1 (`a"b"` char(2));
......@@ -91,8 +94,8 @@ INSERT INTO t1 VALUES ("1\""), ("\"2");
DROP TABLE t1;
--echo #
--echo # Bug #1994
--echo # Bug #4261
--echo # Bug#1994 mysqldump does not correctly dump UCS2 data
--echo # Bug#4261 mysqldump 10.7 (mysql 4.1.2) --skip-extended-insert drops NULL from inserts
--echo #
CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
......@@ -101,7 +104,7 @@ INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL);
DROP TABLE t1;
--echo #
--echo # Bug #2634
--echo # Bug#2634 mysqldump in --compatible=mysql4
--echo #
CREATE TABLE t1 (a int) ENGINE=MYISAM;
......@@ -111,7 +114,7 @@ INSERT INTO t1 VALUES (1), (2);
DROP TABLE t1;
--echo #
--echo # Bug #2592 'mysqldump doesn't quote "tricky" names correctly'
--echo # Bug#2592 mysqldump doesn't quote "tricky" names correctly
--echo #
create table ```a` (i int);
......@@ -119,7 +122,7 @@ create table ```a` (i int);
drop table ```a`;
--echo #
--echo # Bug #2591 "mysqldump quotes names inconsistently"
--echo # Bug#2591 mysqldump quotes names inconsistently
--echo #
create table t1(a int);
......@@ -132,7 +135,7 @@ set global sql_mode='';
drop table t1;
--echo #
--echo # Bug #2705 'mysqldump --tab extra output'
--echo # Bug#2705 mysqldump --tab extra output
--echo #
create table t1(a int);
......@@ -148,7 +151,7 @@ insert into t1 values (1),(2),(3);
drop table t1;
--echo #
--echo # Bug #6101: create database problem
--echo # Bug#6101 create database problem
--echo #
--exec $MYSQL_DUMP --skip-comments --databases test
......@@ -158,7 +161,7 @@ create database mysqldump_test_db character set latin2 collate latin2_bin;
drop database mysqldump_test_db;
--echo #
--echo # Bug #7020
--echo # Bug#7020 mysqldump --compatible=mysql40 should set --skip-set-charset --default-char...
--echo # Check that we don't dump in UTF8 in compatible mode by default,
--echo # but use the default compiled values, or the values given in
--echo # --default-character-set=xxx. However, we should dump in UTF8
......@@ -169,8 +172,8 @@ INSERT INTO t1 VALUES (_latin1 '
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments test t1
--echo #
--echo # Bug#8063: make test mysqldump [ fail ]
--echo # We cannot tes this command because its output depends
--echo # Bug#8063 make test mysqldump [ fail ]
--echo # We cannot test this command because its output depends
--echo # on --default-character-set incompiled into "mysqldump" program.
--echo # If the future we can move this command into a separate test with
--echo # checking that "mysqldump" is compiled with "latin1"
......@@ -183,7 +186,7 @@ INSERT INTO t1 VALUES (_latin1 '
DROP TABLE t1;
--echo #
--echo # WL #2319: Exclude Tables from dump
--echo # WL#2319 Exclude Tables from dump
--echo #
CREATE TABLE t1 (a int);
......@@ -195,7 +198,7 @@ DROP TABLE t1;
DROP TABLE t2;
--echo #
--echo # Bug #8830
--echo # Bug#8830 mysqldump --skip-extended-insert causes --hex-blob to dump wrong values
--echo #
CREATE TABLE t1 (`b` blob);
......@@ -207,7 +210,7 @@ DROP TABLE t1;
--echo # Test for --insert-ignore
--echo #
CREATE TABLE t1 (a int);
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
INSERT INTO t1 VALUES (4),(5),(6);
--exec $MYSQL_DUMP --skip-comments --insert-ignore test t1
......@@ -215,9 +218,9 @@ INSERT INTO t1 VALUES (4),(5),(6);
DROP TABLE t1;
--echo #
--echo # Bug #10286: mysqldump -c crashes on table that has many fields with long
--echo # names
--echo #
--echo # Bug#10286 mysqldump -c crashes on table that has many fields with long
--echo # names
--echo #
create table t1 (
F_c4ca4238a0b923820dcc509a6f75849b int,
F_c81e728d9d4c2f636f067f89cc14862c int,
......@@ -563,7 +566,7 @@ INSERT INTO t1 VALUES (1),(2),(3);
DROP TABLE t1;
--echo #
--echo # Bug #9558 mysqldump --no-data db t1 t2 format still dumps data
--echo # Bug#9558 mysqldump --no-data db t1 t2 format still dumps data
--echo #
CREATE DATABASE mysqldump_test_db;
......@@ -582,7 +585,7 @@ DROP DATABASE mysqldump_test_db;
--echo #
--echo # Testing with tables and databases that don't exists
--echo # or contains illegal characters
--echo # (Bug #9358 mysqldump crashes if tablename starts with \)
--echo # (Bug#9358 mysqldump crashes if tablename starts with \)
--echo #
create database mysqldump_test_db;
use mysqldump_test_db;
......@@ -601,7 +604,7 @@ select '------ Testing with illegal table names ------' as test_sequence ;
--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\\t1" 2>&1
--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\\\\t1" 2>&1
......@@ -644,7 +647,7 @@ use test;
--echo #
--echo # Bug #9657 mysqldump xml ( -x ) does not format NULL fields correctly
--echo # Bug#9657 mysqldump xml ( -x ) does not format NULL fields correctly
--echo #
create table t1 (a int(10));
......@@ -655,8 +658,9 @@ insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thir
--exec $MYSQL_DUMP --skip-comments --xml --no-create-info test
drop table t1, t2;
--echo #
--echo # BUG #12123
--echo # Bug#12123 mysqldump --tab results in text file which can't be imported
--echo #
create table t1 (a text character set utf8, b text character set latin1);
......@@ -669,14 +673,15 @@ select * from t1;
drop table t1;
--echo #
--echo # BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence
--echo # Bug#15328 Segmentation fault occured if my.cnf is invalid for escape sequence
--echo #
--exec $MYSQL_MY_PRINT_DEFAULTS --config-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump
--echo #
--echo # BUG #19025 mysqldump doesn't correctly dump "auto_increment = [int]"
--echo # Bug#19025 mysqldump doesn't correctly dump "auto_increment = [int]"
--echo #
create table `t1` (
......@@ -704,9 +709,11 @@ select * from t1;
show create table `t1`;
drop table `t1`;
--remove_file $MYSQLTEST_VARDIR/tmp/bug19025.sql
--echo #
--echo # Bug #18536: wrong table order
--echo # Bug#18536 wrong table order
--echo #
create table t1(a int);
......@@ -716,8 +723,9 @@ create table t3(a int);
--exec $MYSQL_DUMP --skip-comments --force --no-data test t3 t1 non_existing t2
drop table t1, t2, t3;
--echo #
--echo # Bug #21288: mysqldump segmentation fault when using --where
--echo # Bug#21288 mysqldump segmentation fault when using --where
--echo #
create table t1 (a int);
......@@ -725,8 +733,9 @@ create table t1 (a int);
--exec $MYSQL_DUMP --skip-comments --force test t1 --where="xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" 2>&1
drop table t1;
--echo #
--echo # BUG#13926: --order-by-primary fails if PKEY contains quote character
--echo # Bug#13926 --order-by-primary fails if PKEY contains quote character
--echo #
--disable_warnings
......@@ -746,8 +755,9 @@ DROP TABLE `t1`;
--echo End of 4.1 tests
--echo #
--echo # Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X)
--echo # Bug#10213 mysqldump crashes when dumping VIEWs(on MacOS X)
--echo #
create database db1;
......@@ -770,8 +780,9 @@ drop view v2;
drop database db1;
use test;
--echo #
--echo # Bug 10713 mysqldump includes database in create view and referenced tables
--echo # Bug#10713 mysqldump includes database in create view and referenced tables
--echo #
# create table and views in db2
......@@ -805,18 +816,21 @@ select * from t2 order by a;
drop table t1, t2;
drop database db1;
use test;
--remove_file $MYSQLTEST_VARDIR/tmp/bug10713.sql
#
# dump of view
#
create table t1(a int);
create view v1 as select * from t1;
--exec $MYSQL_DUMP --skip-comments test
drop view v1;
drop table t1;
--echo #
--echo # Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X)
--echo # Bug#10213 mysqldump crashes when dumping VIEWs(on MacOS X)
--echo #
create database mysqldump_test_db;
......@@ -840,7 +854,7 @@ drop database mysqldump_test_db;
use test;
--echo #
--echo # Bug #9756
--echo # Bug#9756 mysql client failing on dumps containing certain \ sequences
--echo #
CREATE TABLE t1 (a char(10));
......@@ -849,7 +863,7 @@ INSERT INTO t1 VALUES ('\'');
DROP TABLE t1;
--echo #
--echo # Bug #10927 mysqldump: Can't reload dump with view that consist of other view
--echo # Bug#10927 mysqldump: Can't reload dump with view that consist of other view
--echo #
create table t1(a int, b int, c varchar(30));
......@@ -921,7 +935,9 @@ show triggers;
DROP TABLE t1, t2;
--echo #
--echo # Bugs #9136, #12917: problems with --defaults-extra-file option
--echo # Bug#9136 my_print_defaults changed behaviour between 4.1.7 and 4.1.10a
--echo # Bug#12917 The --defaults-extra-file option is ignored by the 5.0 client binaries
--echo # (Problems with --defaults-extra-file option)
--echo #
--write_file $MYSQLTEST_VARDIR/tmp/tmp.cnf
......@@ -933,7 +949,7 @@ EOF
--remove_file $MYSQLTEST_VARDIR/tmp/tmp.cnf
--echo #
--echo # Test of fix to BUG 12597
--echo # Test of fix to Bug#12597 mysqldump dumps triggers wrongly
--echo #
DROP TABLE IF EXISTS `test1`;
......@@ -969,9 +985,11 @@ SELECT * FROM `test2`;
DROP TRIGGER testref;
DROP TABLE test1;
DROP TABLE test2;
--remove_file $MYSQLTEST_VARDIR/tmp/mysqldump.sql
--echo #
--echo # BUG#9056 - mysqldump does not dump routines
--echo # Bug#9056 mysqldump does not dump routines
--echo #
--disable_warnings
......@@ -997,9 +1015,9 @@ begin
return f1;
end //
CREATE PROCEDURE bug9056_proc2(OUT a INT)
BEGIN
select sum(id) from t1 into a;
CREATE PROCEDURE bug9056_proc2(OUT a INT)
BEGIN
select sum(id) from t1 into a;
END //
DELIMITER ;//
......@@ -1008,7 +1026,7 @@ set sql_mode='ansi';
create procedure `a'b` () select 1; # to fix syntax highlighting :')
set sql_mode='';
# Dump the DB and ROUTINES
# Dump the DB and ROUTINES
--exec $MYSQL_DUMP --skip-comments --routines --databases test
# ok, now blow it all away
......@@ -1019,8 +1037,9 @@ DROP PROCEDURE bug9056_proc2;
DROP PROCEDURE `a'b`;
drop table t1;
--echo #
--echo # BUG# 13052 - mysqldump timestamp reloads broken
--echo # Bug#13052 mysqldump timestamp reloads broken
--echo #
--disable_warnings
......@@ -1043,7 +1062,7 @@ set global time_zone=default;
set time_zone=default;
--echo #
--echo # Test of fix to BUG 13146 - ansi quotes break loading of triggers
--echo # Test of fix to Bug#13146 ansi quotes break loading of triggers
--echo #
--disable_warnings
......@@ -1068,7 +1087,7 @@ INSERT INTO `t1 test` VALUES (1);
INSERT INTO `t1 test` VALUES (2);
INSERT INTO `t1 test` VALUES (3);
SELECT * FROM `t2 test`;
# dump with compatible=ansi. Everything except triggers should be double
# dump with compatible=ansi. Everything except triggers should be double
# quoted
--exec $MYSQL_DUMP --skip-comments --compatible=ansi --triggers test
......@@ -1077,7 +1096,7 @@ DROP TABLE `t1 test`;
DROP TABLE `t2 test`;
--echo #
--echo # BUG# 12838 mysqldump -x with views exits with error
--echo # Bug#12838 mysqldump -x with views exits with error
--echo #
--disable_warnings
......@@ -1101,7 +1120,7 @@ drop view v1;
drop table t1;
--echo #
--echo # BUG#14554 - mysqldump does not separate words "ROW" and "BEGIN"
--echo # Bug#14554 mysqldump does not separate words "ROW" and "BEGIN"
--echo # for tables with trigger created in the IGNORE_SPACE sql mode.
--echo #
......@@ -1125,8 +1144,8 @@ DROP TRIGGER tr1;
DROP TABLE t1;
--echo #
--echo # Bug #13318: Bad result with empty field and --hex-blob
--echo #
--echo # Bug#13318 Bad result with empty field and --hex-blob
--echo #
create table t1 (a binary(1), b blob);
insert into t1 values ('','');
......@@ -1135,7 +1154,7 @@ insert into t1 values ('','');
drop table t1;
--echo #
--echo # Bug 14871 Invalid view dump output
--echo # Bug#14871 Invalid view dump output
--echo #
create table t1 (a int);
......@@ -1162,9 +1181,11 @@ select * from v3 order by a;
drop table t1;
drop view v1, v2, v3, v4, v5;
--remove_file $MYSQLTEST_VARDIR/tmp/bug14871.sql
--echo #
--echo # Bug #16878 dump of trigger
--echo # Bug#16878 dump of trigger
--echo #
create table t1 (a int, created datetime);
......@@ -1192,6 +1213,8 @@ show triggers;
drop trigger tr1;
drop trigger tr2;
drop table t1, t2;
--remove_file $MYSQLTEST_VARDIR/tmp/bug16878.sql
--echo #
--echo # Bug#18462 mysqldump does not dump view structures correctly
......@@ -1211,11 +1234,15 @@ create view v2 as select qty from v1;
drop view v1;
drop view v2;
drop table t;
--remove_file $MYSQLTEST_VARDIR/tmp/v1.sql
--remove_file $MYSQLTEST_VARDIR/tmp/v2.sql
--remove_file $MYSQLTEST_VARDIR/tmp/t.sql
--remove_file $MYSQLTEST_VARDIR/tmp/t.txt
--echo #
--echo # Bug#14857 Reading dump files with single statement stored routines fails.
--echo # fixed by patch for bug#16878
--echo # fixed by patch for Bug#16878
--echo #
DELIMITER |;
......@@ -1230,7 +1257,7 @@ drop function f;
drop procedure p;
--echo #
--echo # Bug #17371 Unable to dump a schema with invalid views
--echo # Bug#17371 Unable to dump a schema with invalid views
--echo #
create table t1 ( id serial );
......@@ -1243,7 +1270,8 @@ drop table t1;
--echo } mysqldump
drop view v1;
--echo # BUG#17201 Spurious 'DROP DATABASE' in output,
--echo # Bug#17201 Spurious 'DROP DATABASE' in output,
--echo # also confusion between tables and views.
--echo # Example code from Markus Popp
......@@ -1260,8 +1288,9 @@ drop view v1;
drop table t1;
drop database mysqldump_test_db;
--echo #
--echo # Bug21014 Segmentation fault of mysqldump on view
--echo # Bug#21014 Segmentation fault of mysqldump on view
--echo #
create database mysqldump_tables;
......@@ -1280,7 +1309,7 @@ drop table mysqldump_tables.basetable;
drop database mysqldump_tables;
--echo #
--echo # Bug20221 Dumping of multiple databases containing view(s) yields maleformed dumps
--echo # Bug#20221 Dumping of multiple databases containing view(s) yields maleformed dumps
--echo #
create database mysqldump_dba;
......@@ -1318,6 +1347,7 @@ use mysqldump_dbb;
drop view v1;
drop table t1;
drop database mysqldump_dbb;
--remove_file $MYSQLTEST_VARDIR/tmp/bug20221_backup
use test;
--echo #
......@@ -1363,11 +1393,12 @@ grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
drop table t1;
drop user mysqltest_1@localhost;
--echo #
--echo # Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the
--echo # information_schema database.
--echo # Bug#21527 mysqldump incorrectly tries to LOCK TABLES on the
--echo # information_schema database.
--echo #
--echo # Bug #21424 mysqldump failing to export/import views
--echo # Bug#21424 mysqldump failing to export/import views
--echo #
# Do as root
......@@ -1388,7 +1419,7 @@ create table u1 (f1 int);
insert into u1 values (4);
create view v1 (c1) as select * from t1;
# Backup should not fail for Bug #21527. Flush priviliges test begins.
# Backup should not fail for Bug#21527. Flush priviliges test begins.
--exec $MYSQL_DUMP --skip-comments --add-drop-table --flush-privileges --ignore-table=mysql.general_log --ignore-table=mysql.slow_log --databases mysqldump_myDB mysql > $MYSQLTEST_VARDIR/tmp/bug21527.sql
# Clean up
......@@ -1402,8 +1433,9 @@ drop user myDB_User@localhost;
drop database mysqldump_myDB;
flush privileges;
--echo # Bug #21424 continues from here.
--echo # Restore. Flush Privileges test ends.
--echo # Bug#21424 continues from here.
--echo # Restore. Flush Privileges test ends.
--echo #
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21527.sql
......@@ -1416,8 +1448,9 @@ use mysqldump_myDB;
select * from mysqldump_myDB.v1;
select * from mysqldump_myDB.u1;
#Final cleanup.
# Final cleanup.
connection root;
disconnect user1;
use mysqldump_myDB;
drop view v1;
drop table t1;
......@@ -1425,10 +1458,14 @@ drop table u1;
revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
drop user myDB_User@localhost;
drop database mysqldump_myDB;
connection default;
disconnect root;
--remove_file $MYSQLTEST_VARDIR/tmp/bug21527.sql
use test;
--echo #
--echo # Bug #19745: mysqldump --xml produces invalid xml
--echo # Bug#19745 mysqldump --xml produces invalid xml
--echo #
--disable_warnings
......@@ -1443,9 +1480,8 @@ INSERT INTO t1 VALUES(1,0xff00fef0);
DROP TABLE t1;
--echo #
--echo # Bug#26346: stack + buffer overrun in mysqldump
--echo # Bug#26346 stack + buffer overrun in mysqldump
--echo #
CREATE TABLE t1(a int);
......@@ -1466,18 +1502,20 @@ INSERT INTO t1 VALUES (1), (2);
DROP TABLE t1;
#
# Bug #25993: crashe with a merge table and -c
# Bug#25993 crashes with a merge table and -c
#
CREATE TABLE t2 (a int);
CREATE TABLE t3 (a int);
CREATE TABLE t1 (a int) ENGINE=merge UNION=(t2, t3);
CREATE TABLE t2 (a INT);
CREATE TABLE t3 (a INT);
CREATE TABLE t1 (a INT) ENGINE=merge UNION=(t2, t3);
--exec $MYSQL_DUMP --skip-comments -c test
DROP TABLE t1, t2, t3;
--echo #
--echo # Bug #23491: MySQLDump prefix function call in a view by database name
--echo # Bug#23491 MySQLDump prefix function call in a view by database name
--echo #
# Setup
......@@ -1507,15 +1545,16 @@ show create view bug23491_restore.v3;
drop database bug23491_original;
drop database bug23491_restore;
use test;
--remove_file $MYSQLTEST_VARDIR/tmp/bug23491_backup.sql
--echo #
--echo # Bug 27293: mysqldump crashes when dumping routines
--echo # defined by a different user
--echo #
--echo # Bug #22761: mysqldump reports no errors when using
--echo # --routines without mysql.proc privileges
--echo # Bug#27293 mysqldump crashes when dumping routines
--echo # defined by a different user
--echo #
--echo # Bug#22761 mysqldump reports no errors when using
--echo # --routines without mysql.proc privileges
--echo #
create database mysqldump_test_db;
......@@ -1536,13 +1575,14 @@ create procedure mysqldump_test_db.sp1() select 'hello';
drop procedure sp1;
connection default;
disconnect user27293;
drop user user1;
drop user user2;
drop database mysqldump_test_db;
--echo #
--echo # Bug #28522: buffer overrun by '\0' byte using --hex-blob.
--echo # Bug#28522 buffer overrun by '\0' byte using --hex-blob.
--echo #
CREATE TABLE t1 (c1 INT, c2 LONGBLOB);
......@@ -1551,8 +1591,8 @@ INSERT INTO t1 SET c1=11, c2=REPEAT('q',509);
DROP TABLE t1;
--echo #
--echo # Bug #28524: mysqldump --skip-add-drop-table is not
--echo # compatible with views
--echo # Bug#28524 mysqldump --skip-add-drop-table is not
--echo # compatible with views
--echo #
CREATE VIEW v1 AS SELECT 1;
......@@ -1562,10 +1602,12 @@ DROP VIEW v1;
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug28524.sql
SELECT * FROM v1;
DROP VIEW v1;
--remove_file $MYSQLTEST_VARDIR/tmp/bug28524.sql
--echo #
--echo # Bug #29788: mysqldump discards the NO_AUTO_VALUE_ON_ZERO value of
--echo # the SQL_MODE variable after the dumping of triggers.
--echo # Bug#29788 mysqldump discards the NO_AUTO_VALUE_ON_ZERO value of
--echo # the SQL_MODE variable after the dumping of triggers.
--echo #
CREATE TABLE t1 (c1 INT);
......@@ -1584,10 +1626,12 @@ SELECT * FROM t2;
SELECT * FROM t2;
DROP TABLE t1,t2;
--remove_file $MYSQLTEST_VARDIR/tmp/bug29788.sql
--echo #
--echo # Bug#29815: new option for suppressing last line of mysqldump:
--echo # "Dump completed on"
--echo # Bug#29815 new option for suppressing last line of mysqldump:
--echo # "Dump completed on"
--echo #
--echo # --skip-dump-date:
......@@ -1609,3 +1653,6 @@ SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT;
--echo #
--echo # End of 5.0 tests
--echo #
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
......@@ -3,6 +3,10 @@
-- source include/have_ssl.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
......@@ -21,38 +25,42 @@ connect (con2,localhost,ssl_user2,,,,,SSL);
connect (con3,localhost,ssl_user3,,,,,SSL);
connect (con4,localhost,ssl_user4,,,,,SSL);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (con5,localhost,ssl_user5,,,,,SSL);
connection con1;
# Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher';
select * from t1;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
delete from t1;
connection con2;
# Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher';
select * from t1;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
delete from t1;
connection con3;
# Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher';
select * from t1;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
delete from t1;
connection con4;
# Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher';
select * from t1;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
delete from t1;
connection default;
disconnect con1;
disconnect con2;
disconnect con3;
disconnect con4;
drop user ssl_user1@localhost, ssl_user2@localhost,
ssl_user3@localhost, ssl_user4@localhost, ssl_user5@localhost;
......@@ -97,7 +105,7 @@ drop table t1;
--exec $MYSQL_TEST --ssl-cert= --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
#
# BUG#21611 Slave can't connect when master-ssl-cipher specified
# Bug#21611 Slave can't connect when master-ssl-cipher specified
# - Apparently selecting a cipher doesn't work at all
# - Usa a cipher that both yaSSL and OpenSSL supports
#
......@@ -133,7 +141,7 @@ drop table t1;
--exec $MYSQL_TEST --ssl-cipher=UNKNOWN-CIPHER < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
#
# Bug #27669 mysqldump: SSL connection error when trying to connect
# Bug#27669 mysqldump: SSL connection error when trying to connect
#
CREATE TABLE t1(a int);
......@@ -152,3 +160,7 @@ INSERT INTO t1 VALUES (1), (2);
--exec $MYSQL_DUMP --skip-create --skip-comments --ssl --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test 2>&1
DROP TABLE t1;
--remove_file $MYSQLTEST_VARDIR/tmp/test.sql
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
......@@ -5,6 +5,10 @@ eval set @tmpdir="../tmp";
enable_query_log;
-- source include/have_outfile.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
#
# test of into outfile|dumpfile
#
......@@ -46,7 +50,7 @@ select load_file(concat(@tmpdir,"/outfile-test.not-exist"));
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.3
drop table t1;
# Bug#8191
# Bug#8191 SELECT INTO OUTFILE insists on FROM clause
disable_query_log;
eval select 1 into outfile "../tmp/outfile-test.4";
enable_query_log;
......@@ -54,11 +58,11 @@ select load_file(concat(@tmpdir,"/outfile-test.4"));
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
#
# Bug #5382: 'explain select into outfile' crashes the server
# Bug#5382 'explain select into outfile' crashes the server
#
CREATE TABLE t1 (a INT);
EXPLAIN
EXPLAIN
SELECT *
INTO OUTFILE '/tmp/t1.txt'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
......@@ -68,7 +72,7 @@ DROP TABLE t1;
# End of 4.1 tests
#
# Bug#13202 SELECT * INTO OUTFILE ... FROM information_schema.schemata now fails
# Bug#13202 SELECT * INTO OUTFILE ... FROM information_schema.schemata now fails
#
disable_query_log;
eval SELECT * INTO OUTFILE "../tmp/outfile-test.4"
......@@ -114,6 +118,7 @@ from information_schema.schemata
where schema_name like 'mysqltest';
connection default;
disconnect con28181_1;
grant file on *.* to user_1@localhost;
connect (con28181_2,localhost,user_1,,mysqltest);
......@@ -125,9 +130,12 @@ from information_schema.schemata
where schema_name like 'mysqltest';
connection default;
disconnect con28181_2;
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
use test;
revoke all privileges on *.* from user_1@localhost;
drop user user_1@localhost;
drop database mysqltest;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
......@@ -6,7 +6,7 @@ drop table if exists t1,t2;
--enable_warnings
#
# Bug #19263: variables.test doesn't clean up after itself (I/II -- save)
# Bug#19263: variables.test doesn't clean up after itself (I/II -- save)
#
set @my_binlog_cache_size =@@global.binlog_cache_size;
set @my_connect_timeout =@@global.connect_timeout;
......@@ -172,46 +172,46 @@ SELECT @@version_compile_os LIKE 'non-existent';
# The following should give errors
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set big_tables=OFFF;
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set big_tables="OFFF";
--error 1193
--error ER_UNKNOWN_SYSTEM_VARIABLE
set unknown_variable=1;
--error 1232
--error ER_WRONG_TYPE_FOR_VAR
set max_join_size="hello";
--error 1286
--error ER_UNKNOWN_STORAGE_ENGINE
set storage_engine=UNKNOWN_TABLE_TYPE;
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set storage_engine=MERGE, big_tables=2;
show local variables like 'storage_engine';
--error 1229
--error ER_GLOBAL_VARIABLE
set SESSION query_cache_size=10000;
--error 1230
--error ER_NO_DEFAULT
set GLOBAL storage_engine=DEFAULT;
--error 1115
--error ER_UNKNOWN_CHARACTER_SET
set character_set_client=UNKNOWN_CHARACTER_SET;
--error 1273
--error ER_UNKNOWN_COLLATION
set collation_connection=UNKNOWN_COLLATION;
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set character_set_client=NULL;
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set collation_connection=NULL;
--error 1228
--error ER_LOCAL_VARIABLE
set global autocommit=1;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@global.timestamp;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set @@version='';
--error 1229
--error ER_GLOBAL_VARIABLE
set @@concurrent_insert=1;
--error 1228
--error ER_LOCAL_VARIABLE
set @@global.sql_auto_is_null=1;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@global.sql_auto_is_null;
--error 1229
--error ER_GLOBAL_VARIABLE
set myisam_max_sort_file_size=100;
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set @@SQL_WARNINGS=NULL;
# Test setting all variables
......@@ -338,23 +338,23 @@ drop table t1,t2;
# error conditions
#
--error 1193
--error ER_UNKNOWN_SYSTEM_VARIABLE
select @@xxxxxxxxxx;
select 1;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.key_buffer_size;
--error 1229
--error ER_GLOBAL_VARIABLE
set ft_boolean_syntax = @@init_connect;
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set global ft_boolean_syntax = @@init_connect;
--error 1229
--error ER_GLOBAL_VARIABLE
set init_connect = NULL;
set global init_connect = NULL;
--error 1229
--error ER_GLOBAL_VARIABLE
set ft_boolean_syntax = @@init_connect;
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set global ft_boolean_syntax = @@init_connect;
# Bug#3754 SET GLOBAL myisam_max_sort_file_size doesn't work as
......@@ -385,15 +385,15 @@ select @a, @b;
#
# Bug#2586:Disallow global/session/local as structured var. instance names
#
--error 1064
--error ER_PARSE_ERROR
set @@global.global.key_buffer_size= 1;
--error 1064
--error ER_PARSE_ERROR
set GLOBAL global.key_buffer_size= 1;
--error 1064
--error ER_PARSE_ERROR
SELECT @@global.global.key_buffer_size;
--error 1064
--error ER_PARSE_ERROR
SELECT @@global.session.key_buffer_size;
--error 1064
--error ER_PARSE_ERROR
SELECT @@global.local.key_buffer_size;
# BUG#5135: cannot turn on log_warnings with SET in 4.1 (and 4.0)
......@@ -478,27 +478,27 @@ select @@lc_time_names;
--echo *** LC_TIME_NAMES: testing with string expressions
set lc_time_names=concat('de','_','DE');
select @@lc_time_names;
--error 1105
--error ER_UNKNOWN_ERROR
set lc_time_names=concat('de','+','DE');
select @@lc_time_names;
--echo LC_TIME_NAMES: testing with numeric expressions
set @@lc_time_names=1+2;
select @@lc_time_names;
--error 1232
--error ER_WRONG_TYPE_FOR_VAR
set @@lc_time_names=1/0;
select @@lc_time_names;
set lc_time_names=en_US;
--echo LC_TIME_NAMES: testing NULL and a negative number:
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set lc_time_names=NULL;
--error 1105
--error ER_UNKNOWN_ERROR
set lc_time_names=-1;
select @@lc_time_names;
--echo LC_TIME_NAMES: testing locale with the last ID:
set lc_time_names=108;
select @@lc_time_names;
--echo LC_TIME_NAMES: testing a number beyond the valid ID range:
--error 1105
--error ER_UNKNOWN_ERROR
set lc_time_names=109;
select @@lc_time_names;
--echo LC_TIME_NAMES: testing that 0 is en_US:
......@@ -540,7 +540,7 @@ select @@query_prealloc_size = @test;
# Bug#31588 buffer overrun when setting variables
#
# Buffer-size Off By One. Should throw valgrind-warning without fix #31588.
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set global sql_mode=repeat('a',80);
--echo End of 4.1 tests
......@@ -558,9 +558,9 @@ drop table t1;
# Bug #10339: read only variables.
#
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set @@warning_count=1;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set @@global.error_count=1;
#
......@@ -578,9 +578,9 @@ select @@max_heap_table_size > 0;
# Bug #11775 Variable character_set_system does not exist (sometimes)
#
select @@character_set_system;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set global character_set_system = latin1;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set @@global.version_compile_os='234';
#
......@@ -677,7 +677,7 @@ select @@@;
# Don't actually output, since it depends on the system
--replace_column 1 #
select @@hostname;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set @@hostname= "anothername";
--replace_column 2 #
show variables like 'hostname';
......@@ -688,12 +688,12 @@ show variables like 'hostname';
SHOW VARIABLES LIKE 'log';
SELECT @@log;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET GLOBAL log=0;
SHOW VARIABLES LIKE 'log_slow_queries';
SELECT @@log_slow_queries;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET GLOBAL log_slow_queries=0;
--echo End of 5.0 tests
......
......@@ -293,7 +293,12 @@ sub start_mysqlds()
@groups = &find_groups($groupids);
for ($i = 0; defined($groups[$i]); $i++)
{
# Defaults are made explicit parameters to server execution...
@options = defaults_for_group($groups[$i]);
# ...so server MUST NOT try to read again from some config file, especially
# as the "right" file may be unknown to the server if we are using
# --defaults-file=... params in here.
unshift(@options,"--no-defaults");
$mysqld_found= 1; # The default
$mysqld_found= 0 if (!length($mysqld));
......
......@@ -1243,13 +1243,26 @@ Item::Type Item_name_const::type() const
valid_args guarantees value_item->basic_const_item(); if type is
FUNC_ITEM, then we have a fudged item_func_neg() on our hands
and return the underlying type.
For Item_func_set_collation()
e.g. NAME_CONST('name', 'value' COLLATE collation) we return its
'value' argument type.
*/
return valid_args ?
(((value_item->type() == FUNC_ITEM) &&
(((Item_func *) value_item)->functype() == Item_func::NEG_FUNC)) ?
((Item_func *) value_item)->key_item()->type() :
value_item->type()) :
NULL_ITEM;
if (!valid_args)
return NULL_ITEM;
Item::Type value_type= value_item->type();
if (value_type == FUNC_ITEM)
{
/*
The second argument of NAME_CONST('name', 'value') must be
a simple constant item or a NEG_FUNC/COLLATE_FUNC.
*/
DBUG_ASSERT(((Item_func *) value_item)->functype() ==
Item_func::NEG_FUNC ||
((Item_func *) value_item)->functype() ==
Item_func::COLLATE_FUNC);
return ((Item_func *) value_item)->key_item()->type();
}
return value_type;
}
......
......@@ -78,7 +78,6 @@ static store_key *get_store_key(THD *thd,
KEYUSE *keyuse, table_map used_tables,
KEY_PART_INFO *key_part, char *key_buff,
uint maybe_null);
static bool make_simple_join(JOIN *join,TABLE *tmp_table);
static void make_outerjoin_info(JOIN *join);
static bool make_join_select(JOIN *join,SQL_SELECT *select,COND *item);
static void make_join_readinfo(JOIN *join, ulonglong options);
......@@ -1809,7 +1808,7 @@ JOIN::exec()
/* Free first data from old join */
curr_join->join_free();
if (make_simple_join(curr_join, curr_tmp_table))
if (curr_join->make_simple_join(this, curr_tmp_table))
DBUG_VOID_RETURN;
calc_group_buffer(curr_join, group_list);
count_field_types(select_lex, &curr_join->tmp_table_param,
......@@ -1929,7 +1928,7 @@ JOIN::exec()
curr_join->select_distinct=0;
}
curr_tmp_table->reginfo.lock_type= TL_UNLOCK;
if (make_simple_join(curr_join, curr_tmp_table))
if (curr_join->make_simple_join(this, curr_tmp_table))
DBUG_VOID_RETURN;
calc_group_buffer(curr_join, curr_join->group_list);
count_field_types(select_lex, &curr_join->tmp_table_param,
......@@ -5431,48 +5430,42 @@ store_val_in_field(Field *field, Item *item, enum_check_fields check_flag)
}
static bool
make_simple_join(JOIN *join,TABLE *tmp_table)
/**
@details Initialize a JOIN as a query execution plan
that accesses a single table via a table scan.
@param parent contains JOIN_TAB and TABLE object buffers for this join
@param tmp_table temporary table
@retval FALSE success
@retval TRUE error occurred
*/
bool
JOIN::make_simple_join(JOIN *parent, TABLE *tmp_table)
{
TABLE **tableptr;
JOIN_TAB *join_tab;
DBUG_ENTER("make_simple_join");
DBUG_ENTER("JOIN::make_simple_join");
/*
Reuse TABLE * and JOIN_TAB if already allocated by a previous call
to this function through JOIN::exec (may happen for sub-queries).
*/
if (!join->table_reexec)
{
if (!(join->table_reexec= (TABLE**) join->thd->alloc(sizeof(TABLE*))))
DBUG_RETURN(TRUE); /* purecov: inspected */
if (join->tmp_join)
join->tmp_join->table_reexec= join->table_reexec;
}
if (!join->join_tab_reexec)
{
if (!(join->join_tab_reexec=
(JOIN_TAB*) join->thd->alloc(sizeof(JOIN_TAB))))
DBUG_RETURN(TRUE); /* purecov: inspected */
if (join->tmp_join)
join->tmp_join->join_tab_reexec= join->join_tab_reexec;
}
tableptr= join->table_reexec;
join_tab= join->join_tab_reexec;
join->join_tab=join_tab;
join->table=tableptr; tableptr[0]=tmp_table;
join->tables=1;
join->const_tables=0;
join->const_table_map=0;
join->tmp_table_param.field_count= join->tmp_table_param.sum_func_count=
join->tmp_table_param.func_count=0;
join->tmp_table_param.copy_field=join->tmp_table_param.copy_field_end=0;
join->first_record=join->sort_and_group=0;
join->send_records=(ha_rows) 0;
join->group=0;
join->row_limit=join->unit->select_limit_cnt;
join->do_send_rows = (join->row_limit) ? 1 : 0;
if (!parent->join_tab_reexec &&
!(parent->join_tab_reexec= (JOIN_TAB*) thd->alloc(sizeof(JOIN_TAB))))
DBUG_RETURN(TRUE); /* purecov: inspected */
join_tab= parent->join_tab_reexec;
table= &parent->table_reexec[0]; parent->table_reexec[0]= tmp_table;
tables= 1;
const_tables= 0;
const_table_map= 0;
tmp_table_param.field_count= tmp_table_param.sum_func_count=
tmp_table_param.func_count= 0;
tmp_table_param.copy_field= tmp_table_param.copy_field_end=0;
first_record= sort_and_group=0;
send_records= (ha_rows) 0;
group= 0;
row_limit= unit->select_limit_cnt;
do_send_rows= row_limit ? 1 : 0;
join_tab->cache.buff=0; /* No caching */
join_tab->table=tmp_table;
......@@ -5489,7 +5482,7 @@ make_simple_join(JOIN *join,TABLE *tmp_table)
join_tab->ref.key = -1;
join_tab->not_used_in_distinct=0;
join_tab->read_first_record= join_init_read_record;
join_tab->join=join;
join_tab->join= this;
join_tab->ref.key_parts= 0;
bzero((char*) &join_tab->read_record,sizeof(join_tab->read_record));
tmp_table->status=0;
......
......@@ -352,9 +352,12 @@ public:
cleared only at the end of the execution of the whole query and not caching
allocations that occur in repetition at execution time will result in
excessive memory usage.
Note: make_simple_join always creates an execution plan that accesses
a single table, thus it is sufficient to have a one-element array for
table_reexec.
*/
SORT_FIELD *sortorder; // make_unireg_sortorder()
TABLE **table_reexec; // make_simple_join()
TABLE *table_reexec[1]; // make_simple_join()
JOIN_TAB *join_tab_reexec; // make_simple_join()
/* end of allocation caching storage */
......@@ -384,7 +387,7 @@ public:
exec_tmp_table1= 0;
exec_tmp_table2= 0;
sortorder= 0;
table_reexec= 0;
table_reexec[0]= 0;
join_tab_reexec= 0;
thd= thd_arg;
sum_funcs= sum_funcs2= 0;
......@@ -476,6 +479,8 @@ public:
return (unit == &thd->lex->unit && (unit->fake_select_lex == 0 ||
select_lex == unit->fake_select_lex));
}
private:
bool make_simple_join(JOIN *join, TABLE *tmp_table);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment