Commit 1ce81aac authored by Ramil Kalimullin's avatar Ramil Kalimullin

merge

parents d3e317d1 652565d3
[MYSQL]
post_commit_to = "commits@lists.mysql.com"
post_push_to = "commits@lists.mysql.com"
tree_name = "mysql-5.1-bugteam"
tree_name = "mysql-5.0-bugteam"
......@@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line!
# remember to also change ndb version below and update version.c in ndb
AM_INIT_AUTOMAKE(mysql, 5.0.70)
AM_INIT_AUTOMAKE(mysql, 5.0.72)
AM_CONFIG_HEADER([include/config.h:config.h.in])
PROTOCOL_VERSION=10
......@@ -23,7 +23,7 @@ NDB_SHARED_LIB_VERSION=$NDB_SHARED_LIB_MAJOR_VERSION:0:0
# ndb version
NDB_VERSION_MAJOR=5
NDB_VERSION_MINOR=0
NDB_VERSION_BUILD=70
NDB_VERSION_BUILD=72
NDB_VERSION_STATUS=""
# Set all version vars based on $VERSION. How do we do this more elegant ?
......@@ -2810,6 +2810,9 @@ EOF
AC_CONFIG_SUBDIRS(innobase)
fi
# "innochecksum" is not in the "innobase/" subdirectory, but should be switched
AM_CONDITIONAL([BUILD_INNODB_TOOLS], [test X"$have_innodb" = Xyes])
case $SYSTEM_TYPE-$MACHINE_TYPE-$ac_cv_prog_gcc-$have_ndbcluster in
*solaris*-i?86-no-yes)
if $CC -xildon 2>&1 | grep "illegal option" >/dev/null
......
......@@ -45,7 +45,12 @@ $(top_builddir)/include/mysqld_ername.h: $(top_builddir)/include/mysqld_error.h
$(top_builddir)/include/sql_state.h: $(top_builddir)/include/mysqld_error.h
bin_PROGRAMS = replace comp_err perror resolveip my_print_defaults \
resolve_stack_dump mysql_waitpid innochecksum
resolve_stack_dump mysql_waitpid
# "innochecksum" should be switched
if BUILD_INNODB_TOOLS
bin_PROGRAMS += innochecksum
endif
noinst_PROGRAMS = charset2html
EXTRA_DIST = CMakeLists.txt
......
......@@ -21,5 +21,11 @@ man1_MANS = @man1_files@
man8_MANS = @man8_files@
EXTRA_DIST = $(man1_MANS) $(man8_MANS)
# 1) not needed in Unix binary packages,
# 2) programs not generated in 5.0:
install-data-hook:
rm -f $(DESTDIR)$(manlibdir)/man1/make_win_*
rm -f $(DESTDIR)$(manlibdir)/man1/ndb_print_*
# Don't update the files from bitkeeper
%::SCCS/s.%
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults $ndb_restore_opts -b $the_backup_id -n 1 $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id $ndb_restore_filter > $MYSQLTEST_VARDIR/tmp/tmp.dat
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults $ndb_restore_opts -b $the_backup_id -n 2 $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id $ndb_restore_filter >> $MYSQLTEST_VARDIR/tmp/tmp.dat
--exec sort $MYSQLTEST_VARDIR/tmp/tmp.dat
--exec rm -f $MYSQLTEST_VARDIR/tmp/tmp.dat
--error 0,1
--remove_file $MYSQLTEST_VARDIR/tmp/tmp.dat
--let ndb_restore_opts=
--let ndb_restore_filter=
......@@ -608,6 +608,65 @@ id select_type table type possible_keys key key_len ref rows Extra
SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a;
a a
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (id INT NOT NULL, fruit_id INT NOT NULL, fruit_name varchar(20)
default NULL);
INSERT INTO t1 VALUES (1,1,'ORANGE');
INSERT INTO t1 VALUES (2,2,'APPLE');
INSERT INTO t1 VALUES (3,2,'APPLE');
INSERT INTO t1 VALUES (4,3,'PEAR');
SELECT DISTINCT fruit_id, fruit_name INTO @v1, @v2 FROM t1 WHERE fruit_name =
'APPLE';
SELECT @v1, @v2;
@v1 @v2
2 APPLE
SELECT DISTINCT fruit_id, fruit_name INTO @v3, @v4 FROM t1 GROUP BY fruit_id,
fruit_name HAVING fruit_name = 'APPLE';
SELECT @v3, @v4;
@v3 @v4
2 APPLE
SELECT DISTINCT @v5:= fruit_id, @v6:= fruit_name INTO @v7, @v8 FROM t1 WHERE
fruit_name = 'APPLE';
SELECT @v5, @v6, @v7, @v8;
@v5 @v6 @v7 @v8
3 PEAR 3 PEAR
SELECT DISTINCT @v5 + fruit_id, CONCAT(@v6, fruit_name) INTO @v9, @v10 FROM t1
WHERE fruit_name = 'APPLE';
SELECT @v5, @v6, @v7, @v8, @v9, @v10;
@v5 @v6 @v7 @v8 @v9 @v10
3 PEAR 3 PEAR 5 PEARAPPLE
SELECT DISTINCT @v11:= @v5 + fruit_id, @v12:= CONCAT(@v6, fruit_name) INTO
@v13, @v14 FROM t1 WHERE fruit_name = 'APPLE';
SELECT @v11, @v12, @v13, @v14;
@v11 @v12 @v13 @v14
6 PEARPEAR 6 PEARPEAR
SELECT DISTINCT @v13, @v14 INTO @v15, @v16 FROM t1 WHERE fruit_name = 'APPLE';
SELECT @v15, @v16;
@v15 @v16
6 PEARPEAR
SELECT DISTINCT 2 + 2, 'Bob' INTO @v17, @v18 FROM t1 WHERE fruit_name =
'APPLE';
SELECT @v17, @v18;
@v17 @v18
4 Bob
DROP TABLE IF EXISTS t2;
CREATE TABLE t2 (fruit_id INT NOT NULL, fruit_name varchar(20)
default NULL);
SELECT DISTINCT fruit_id, fruit_name INTO OUTFILE
'../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE';
LOAD DATA INFILE '../tmp/data1.tmp' INTO TABLE t2;
SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE
'../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE';
LOAD DATA INFILE '../tmp/data2.tmp' INTO TABLE t2;
SELECT @v19, @v20;
@v19 @v20
2 APPLE
SELECT * FROM t2;
fruit_id fruit_name
2 APPLE
2 APPLE
DROP TABLE t1;
DROP TABLE t2;
CREATE TABLE t1 (a CHAR(1));
INSERT INTO t1 VALUES('A'), (0);
SELECT a FROM t1 WHERE a=0;
......
This diff is collapsed.
......@@ -328,3 +328,123 @@ DROP VIEW v2;
DROP VIEW v3;
# -- End of Bug#35469.
Bug#37114
SET SESSION character_set_client=latin1;
SET SESSION character_set_server=latin1;
SET SESSION character_set_connection=latin1;
SET @OLD_SQL_MODE=@@SESSION.SQL_MODE;
test LOAD DATA INFILE
SET sql_mode = '';
SELECT '1 \\aa\n' INTO DUMPFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt';
CREATE TABLE t1 (id INT, val1 CHAR(3)) ENGINE=MyISAM;
SET sql_mode = 'NO_BACKSLASH_ESCAPES';
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' REPLACE INTO TABLE t1 FIELDS TERMINATED BY ' ';
SELECT * FROM t1;
id val1
1 \aa
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug37114_out.txt' FIELDS ESCAPED BY '' TERMINATED BY ' ' FROM t1;
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug37114_out.txt' FIELDS TERMINATED BY ' ' FROM t1;
INSERT INTO t1 (id, val1) VALUES (1, '\aa');
SELECT * FROM t1;
id val1
1 \aa
1 \aa
SET sql_mode='';
INSERT INTO t1 (id, val1) VALUES (1, '\aa');
SELECT * FROM t1;
id val1
1 \aa
1 \aa
1 aa
DROP TABLE t1;
test SELECT INTO OUTFILE
CREATE TABLE t1 (id INT PRIMARY KEY, val1 CHAR(4));
CREATE TABLE t2 LIKE t1;
SET sql_mode = '';
INSERT INTO t1 (id, val1) VALUES (5, '\ttab');
INSERT INTO t1 (id, val1) VALUES (4, '\\r');
SET sql_mode = 'NO_BACKSLASH_ESCAPES';
INSERT INTO t1 (id, val1) VALUES (3, '\tx');
1.1 NO_BACKSLASH_ESCAPES, use defaults for ESCAPED BY
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' FIELDS TERMINATED BY ' ' FROM t1 ORDER BY id;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' INTO TABLE t2 FIELDS TERMINATED BY ' ';
SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION
SELECT 'after' AS t, id, val1, hex(val1) FROM t2 ORDER BY id,t DESC;
t id val1 hex(val1)
before 3 \tx 5C7478
after 3 \tx 5C7478
before 4 \r 5C72
after 4 \r 5C72
before 5 tab 09746162
after 5 tab 09746162
TRUNCATE t2;
SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt");
LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt")
3 \tx
4 \r
5 tab
1.2 NO_BACKSLASH_ESCAPES, override defaults for ESCAPED BY
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' FIELDS ESCAPED BY '\' TERMINATED BY ' ' FROM t1 ORDER BY id;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' INTO TABLE t2 FIELDS ESCAPED BY '\' TERMINATED BY ' ';
SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION
SELECT 'after' AS t, id, val1, hex(val1) FROM t2 ORDER BY id,t DESC;
t id val1 hex(val1)
before 3 \tx 5C7478
after 3 \tx 5C7478
before 4 \r 5C72
after 4 \r 5C72
before 5 tab 09746162
after 5 tab 09746162
TRUNCATE t2;
SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt");
LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt")
3 \\tx
4 \\r
5 tab
SET sql_mode = '';
2.1 !NO_BACKSLASH_ESCAPES, use defaults for ESCAPED BY
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' FIELDS TERMINATED BY ' ' FROM t1 ORDER BY id;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' INTO TABLE t2 FIELDS TERMINATED BY ' ';
SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION
SELECT 'after' AS t, id, val1, hex(val1) FROM t2 ORDER BY id,t DESC;
t id val1 hex(val1)
before 3 \tx 5C7478
after 3 \tx 5C7478
before 4 \r 5C72
after 4 \r 5C72
before 5 tab 09746162
after 5 tab 09746162
TRUNCATE t2;
SET sql_mode = 'NO_BACKSLASH_ESCAPES';
SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt");
LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt")
3 \\tx
4 \\r
5 tab
SET sql_mode = '';
2.2 !NO_BACKSLASH_ESCAPES, override defaults for ESCAPED BY
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' FIELDS ESCAPED BY '' TERMINATED BY ' ' FROM t1 ORDER BY id;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug37114.txt' INTO TABLE t2 FIELDS ESCAPED BY '' TERMINATED BY ' ';
SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION
SELECT 'after' AS t, id, val1, hex(val1) FROM t2 ORDER BY id,t DESC;
t id val1 hex(val1)
before 3 \tx 5C7478
after 3 \tx 5C7478
before 4 \r 5C72
after 4 \r 5C72
before 5 tab 09746162
after 5 tab 09746162
TRUNCATE t2;
SET sql_mode = 'NO_BACKSLASH_ESCAPES';
SELECT LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt");
LOAD_FILE("MYSQLTEST_VARDIR/tmp/bug37114.txt")
3 \tx
4 \r
5 tab
set session sql_mode=@OLD_SQL_MODE;
DROP TABLE t1,t2;
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
SET @OLD_CONCURRENT_INSERT = @@GLOBAL.CONCURRENT_INSERT;
SET @@GLOBAL.CONCURRENT_INSERT = 0;
DROP TABLE IF EXISTS t1, `"t"1`, t1aa, t2, t2aa, t3;
drop database if exists mysqldump_test_db;
drop database if exists db1;
......@@ -3565,6 +3570,7 @@ DROP TABLE t1,t2;
-- Dump completed on DATE
SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT;
#
# End of 5.0 tests
#
......@@ -1513,3 +1513,10 @@ end loop label1;
end loop;
end|
ERROR 42000: End-label label1 without match
CREATE TABLE t1 (a INT)|
INSERT INTO t1 VALUES (1),(2)|
CREATE PROCEDURE p1(a INT) BEGIN END|
CALL p1((SELECT * FROM t1))|
ERROR 21000: Subquery returns more than 1 row
DROP PROCEDURE IF EXISTS p1|
DROP TABLE t1|
......@@ -6662,6 +6662,16 @@ drop procedure p1;
drop function f1;
drop view v1;
drop table t1;
drop procedure if exists `p2` $
create procedure `p2`(in `a` text charset utf8)
begin
declare `pos` int default 1;
declare `str` text charset utf8;
set `str` := `a`;
select substr(`str`, `pos`+ 1 ) into `str`;
end $
call `p2`('s s s s s s');
drop procedure `p2`;
# ------------------------------------------------------------------
# -- End of 5.0 tests
# ------------------------------------------------------------------
......@@ -30,7 +30,7 @@ let $error_code= `select @a like "%#%error_code=0%" /* must return 1 */`;
eval select $error_code /* must return 1 as query completed before got killed*/;
# cleanup for the sub-case
system rm $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;
remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;
#
......@@ -58,7 +58,7 @@ let $error_code= `select @a like "%#%error_code=0%" /* must return 0*/`;
eval select $error_code /* must return 0 to mean the killed query is in */;
# cleanup for the sub-case
system rm $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;
remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;
drop table t1,t2;
......
......@@ -21,4 +21,4 @@ select * from t2;
# clean up
drop table t1,t2;
#--system rm $MYSQLTEST_VARDIR/tmp/binlog_start_comment.binlog
#--remove_file $MYSQLTEST_VARDIR/tmp/binlog_start_comment.binlog
......@@ -79,7 +79,8 @@ delete from t1;
--eval select hex(load_file('$MYSQLTEST_VARDIR/master-data/test/t1.txt'));
load data infile 't1.txt' into table t1;
select hex(a) from t1;
--exec rm $MYSQLTEST_VARDIR/master-data/test/t1.txt
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.txt
drop table t1;
--echo End of 5.0 tests
......@@ -438,72 +438,71 @@ EXPLAIN SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a;
SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a;
DROP TABLE t1;
# The test case for bug#20836 should be re-enabled when bug#16861 is resolved
# The results for the test should be the same as in 4.1.
#
#Bug #20836: Selecting into variables results in wrong results being returned
#
#--disable_warnings
#DROP TABLE IF EXISTS t1;
#--enable_warnings
#
#CREATE TABLE t1 (id INT NOT NULL, fruit_id INT NOT NULL, fruit_name varchar(20)
#default NULL);
#
#INSERT INTO t1 VALUES (1,1,'ORANGE');
#INSERT INTO t1 VALUES (2,2,'APPLE');
#INSERT INTO t1 VALUES (3,2,'APPLE');
#INSERT INTO t1 VALUES (4,3,'PEAR');
#
#SELECT DISTINCT fruit_id, fruit_name INTO @v1, @v2 FROM t1 WHERE fruit_name =
#'APPLE';
#SELECT @v1, @v2;
#
#SELECT DISTINCT fruit_id, fruit_name INTO @v3, @v4 FROM t1 GROUP BY fruit_id,
#fruit_name HAVING fruit_name = 'APPLE';
#SELECT @v3, @v4;
#
#SELECT DISTINCT @v5:= fruit_id, @v6:= fruit_name INTO @v7, @v8 FROM t1 WHERE
#fruit_name = 'APPLE';
#SELECT @v5, @v6, @v7, @v8;
#
#SELECT DISTINCT @v5 + fruit_id, CONCAT(@v6, fruit_name) INTO @v9, @v10 FROM t1
#WHERE fruit_name = 'APPLE';
#SELECT @v5, @v6, @v7, @v8, @v9, @v10;
#
#SELECT DISTINCT @v11:= @v5 + fruit_id, @v12:= CONCAT(@v6, fruit_name) INTO
#@v13, @v14 FROM t1 WHERE fruit_name = 'APPLE';
#SELECT @v11, @v12, @v13, @v14;
#
#SELECT DISTINCT @v13, @v14 INTO @v15, @v16 FROM t1 WHERE fruit_name = 'APPLE';
#SELECT @v15, @v16;
#
#SELECT DISTINCT 2 + 2, 'Bob' INTO @v17, @v18 FROM t1 WHERE fruit_name =
#'APPLE';
#SELECT @v17, @v18;
#
#--disable_warnings
#DROP TABLE IF EXISTS t2;
#--enable_warnings
#
#CREATE TABLE t2 (fruit_id INT NOT NULL, fruit_name varchar(20)
#default NULL);
#
#SELECT DISTINCT fruit_id, fruit_name INTO OUTFILE
#'../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE';
#LOAD DATA INFILE '../tmp/data1.tmp' INTO TABLE t2;
#--exec rm $MYSQL_TEST_DIR/var/tmp/data1.tmp
#
#SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE
#'../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE';
#LOAD DATA INFILE '../tmp/data2.tmp' INTO TABLE t2;
#--exec rm $MYSQL_TEST_DIR/var/tmp/data2.tmp
#
#SELECT @v19, @v20;
#SELECT * FROM t2;
#
#DROP TABLE t1;
#DROP TABLE t2;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (id INT NOT NULL, fruit_id INT NOT NULL, fruit_name varchar(20)
default NULL);
INSERT INTO t1 VALUES (1,1,'ORANGE');
INSERT INTO t1 VALUES (2,2,'APPLE');
INSERT INTO t1 VALUES (3,2,'APPLE');
INSERT INTO t1 VALUES (4,3,'PEAR');
SELECT DISTINCT fruit_id, fruit_name INTO @v1, @v2 FROM t1 WHERE fruit_name =
'APPLE';
SELECT @v1, @v2;
SELECT DISTINCT fruit_id, fruit_name INTO @v3, @v4 FROM t1 GROUP BY fruit_id,
fruit_name HAVING fruit_name = 'APPLE';
SELECT @v3, @v4;
SELECT DISTINCT @v5:= fruit_id, @v6:= fruit_name INTO @v7, @v8 FROM t1 WHERE
fruit_name = 'APPLE';
SELECT @v5, @v6, @v7, @v8;
SELECT DISTINCT @v5 + fruit_id, CONCAT(@v6, fruit_name) INTO @v9, @v10 FROM t1
WHERE fruit_name = 'APPLE';
SELECT @v5, @v6, @v7, @v8, @v9, @v10;
SELECT DISTINCT @v11:= @v5 + fruit_id, @v12:= CONCAT(@v6, fruit_name) INTO
@v13, @v14 FROM t1 WHERE fruit_name = 'APPLE';
SELECT @v11, @v12, @v13, @v14;
SELECT DISTINCT @v13, @v14 INTO @v15, @v16 FROM t1 WHERE fruit_name = 'APPLE';
SELECT @v15, @v16;
SELECT DISTINCT 2 + 2, 'Bob' INTO @v17, @v18 FROM t1 WHERE fruit_name =
'APPLE';
SELECT @v17, @v18;
--disable_warnings
DROP TABLE IF EXISTS t2;
--enable_warnings
CREATE TABLE t2 (fruit_id INT NOT NULL, fruit_name varchar(20)
default NULL);
SELECT DISTINCT fruit_id, fruit_name INTO OUTFILE
'../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE';
LOAD DATA INFILE '../tmp/data1.tmp' INTO TABLE t2;
--error 0,1
--remove_file $MYSQLTEST_VARDIR/tmp/data1.tmp
SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE
'../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE';
LOAD DATA INFILE '../tmp/data2.tmp' INTO TABLE t2;
--remove_file $MYSQLTEST_VARDIR/tmp/data2.tmp
SELECT @v19, @v20;
SELECT * FROM t2;
DROP TABLE t1;
DROP TABLE t2;
#
# Bug #15881: cast problems
......
This diff is collapsed.
......@@ -318,4 +318,184 @@ DROP VIEW v3;
###########################################################################
# End of 5.0 tests
#
# Bug#37114: sql_mode NO_BACKSLASH_ESCAPES does not work properly with
# LOAD DATA INFILE
#
# - For each plain "SELECT id,...", the 1st pair ("before" SELECT...OUTFILE,
# LOAD...INFILE) and the 2nd pair of lines ("after") in the result should
# look the same, otherwise we broke the dumpe/restore cycle!
#
# - the \r is always { '\\', 'r' } in memory, but on-disk format changes
#
# - the \t is { '\t' } or { '\\', 't' } in memory depending on whether \
# is magic (that is, NO_BACKSLASH_ESCAPES is not set) at INSERT-time.
# on-disk format varies.
#
# - while INFILE/OUTFILE behaviour changes according to NO_BACKSLASH_ESCAPES,
# we can override these defaults using ESCAPED BY '...'
# 1: NO_BACKSLASH_ESCAPES default, \ on-disk: \,t,x,\r
# 2: NO_BACKSLASH_ESCAPES override, \\ on-disk: \,\,t,x,\,\,r
# 3: !NO_BACKSLASH_ESCAPES default, \\ on-disk: tab,\,\,r
# 3: !NO_BACKSLASH_ESCAPES override, \ on-disk: tab,\,r
--echo Bug#37114
SET SESSION character_set_client=latin1;
SET SESSION character_set_server=latin1;
SET SESSION character_set_connection=latin1;
SET @OLD_SQL_MODE=@@SESSION.SQL_MODE;
# 0. test LOAD DATA INFILE first; if that works, all issues in
# SELECT INTO OUTFILE / LOAD DATA INFILE cycles below are
# arguably in the saving.
--echo test LOAD DATA INFILE
--let $file=$MYSQLTEST_VARDIR/tmp/bug37114.txt
--let $file2=$MYSQLTEST_VARDIR/tmp/bug37114_out.txt
SET sql_mode = '';
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT '1 \\\\aa\n' INTO DUMPFILE '$file'
CREATE TABLE t1 (id INT, val1 CHAR(3)) ENGINE=MyISAM;
SET sql_mode = 'NO_BACKSLASH_ESCAPES';
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$file' REPLACE INTO TABLE t1 FIELDS TERMINATED BY ' '
SELECT * FROM t1;
# show we can write this with OUTFILE, forcing the parameters for now
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT * INTO OUTFILE '$file2' FIELDS ESCAPED BY '' TERMINATED BY ' ' FROM t1
--diff_files $file $file2
--remove_file $file2
# now show the OUTFILE defaults are correct with NO_BACKSLASH_ESCAPES
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT * INTO OUTFILE '$file2' FIELDS TERMINATED BY ' ' FROM t1
--diff_files $file $file2
--remove_file $file2
INSERT INTO t1 (id, val1) VALUES (1, '\aa');
SELECT * FROM t1;
SET sql_mode='';
INSERT INTO t1 (id, val1) VALUES (1, '\aa');
SELECT * FROM t1;
DROP TABLE t1;
--remove_file $file
--echo test SELECT INTO OUTFILE
CREATE TABLE t1 (id INT PRIMARY KEY, val1 CHAR(4));
CREATE TABLE t2 LIKE t1;
# 1. with NO_BACKSLASH_ESCAPES on
SET sql_mode = '';
INSERT INTO t1 (id, val1) VALUES (5, '\ttab');
INSERT INTO t1 (id, val1) VALUES (4, '\\r');
SET sql_mode = 'NO_BACKSLASH_ESCAPES';
INSERT INTO t1 (id, val1) VALUES (3, '\tx');
--echo 1.1 NO_BACKSLASH_ESCAPES, use defaults for ESCAPED BY
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT * INTO OUTFILE '$file' FIELDS TERMINATED BY ' ' FROM t1 ORDER BY id
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$file' INTO TABLE t2 FIELDS TERMINATED BY ' '
SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION
SELECT 'after' AS t, id, val1, hex(val1) FROM t2 ORDER BY id,t DESC;
TRUNCATE t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval SELECT LOAD_FILE("$file");
--remove_file $file
--echo 1.2 NO_BACKSLASH_ESCAPES, override defaults for ESCAPED BY
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT * INTO OUTFILE '$file' FIELDS ESCAPED BY '\' TERMINATED BY ' ' FROM t1 ORDER BY id
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$file' INTO TABLE t2 FIELDS ESCAPED BY '\' TERMINATED BY ' '
SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION
SELECT 'after' AS t, id, val1, hex(val1) FROM t2 ORDER BY id,t DESC;
TRUNCATE t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval SELECT LOAD_FILE("$file");
--remove_file $file
# 2. with NO_BACKSLASH_ESCAPES off
SET sql_mode = '';
--echo 2.1 !NO_BACKSLASH_ESCAPES, use defaults for ESCAPED BY
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT * INTO OUTFILE '$file' FIELDS TERMINATED BY ' ' FROM t1 ORDER BY id
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$file' INTO TABLE t2 FIELDS TERMINATED BY ' '
SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION
SELECT 'after' AS t, id, val1, hex(val1) FROM t2 ORDER BY id,t DESC;
TRUNCATE t2;
SET sql_mode = 'NO_BACKSLASH_ESCAPES';
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval SELECT LOAD_FILE("$file");
--remove_file $file
SET sql_mode = '';
--echo 2.2 !NO_BACKSLASH_ESCAPES, override defaults for ESCAPED BY
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT * INTO OUTFILE '$file' FIELDS ESCAPED BY '' TERMINATED BY ' ' FROM t1 ORDER BY id
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$file' INTO TABLE t2 FIELDS ESCAPED BY '' TERMINATED BY ' '
SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION
SELECT 'after' AS t, id, val1, hex(val1) FROM t2 ORDER BY id,t DESC;
TRUNCATE t2;
SET sql_mode = 'NO_BACKSLASH_ESCAPES';
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval SELECT LOAD_FILE("$file");
--remove_file $file
# clean up
set session sql_mode=@OLD_SQL_MODE;
DROP TABLE t1,t2;
--echo End of 5.0 tests
......@@ -5,6 +5,14 @@
# Binlog is required
--source include/have_log_bin.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
SET @OLD_CONCURRENT_INSERT = @@GLOBAL.CONCURRENT_INSERT;
SET @@GLOBAL.CONCURRENT_INSERT = 0;
--disable_warnings
DROP TABLE IF EXISTS t1, `"t"1`, t1aa, t2, t2aa, t3;
drop database if exists mysqldump_test_db;
......@@ -1594,6 +1602,10 @@ DROP TABLE t1,t2;
--replace_regex /-- [^D][^u][^m][^p].*// /\/\*!.*// / on [0-9 :-]+/ on DATE/
--exec $MYSQL_DUMP test
# We reset concurrent_inserts value to whatever it was at the start of the test
SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT;
--echo #
--echo # End of 5.0 tests
--echo #
......@@ -24,7 +24,7 @@ create table t1(
insert into t1 values(1, "Autodiscover");
flush tables;
system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
select * from t1;
show status like 'handler_discover%';
......@@ -33,13 +33,13 @@ show status like 'handler_discover%';
#
flush tables;
system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
insert into t1 values (2, "Auto 2");
show status like 'handler_discover%';
insert into t1 values (3, "Discover 3");
show status like 'handler_discover%';
flush tables;
system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
select * from t1 order by id;
show status like 'handler_discover%';
......@@ -48,7 +48,7 @@ show status like 'handler_discover%';
#
flush tables;
system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
update t1 set name="Autodiscover" where id = 2;
show status like 'handler_discover%';
select * from t1 order by id;
......@@ -59,7 +59,7 @@ show status like 'handler_discover%';
#
flush tables;
system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
delete from t1 where id = 3;
select * from t1 order by id;
show status like 'handler_discover%';
......@@ -111,9 +111,9 @@ show status like 'handler_discover%';
flush tables;
# Remove the frm file from disk
system rm $MYSQLTEST_VARDIR/master-data/test/t3.frm ;
remove_file $MYSQLTEST_VARDIR/master-data/test/t3.frm ;
--error 1050
--error ER_TABLE_EXISTS_ERROR
create table t3(
id int not null primary key,
name char(20), a int, b float, c char(24)
......@@ -168,14 +168,14 @@ show status like 'handler_discover%';
# Remove the frm file from disk
flush tables;
system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm ;
remove_file $MYSQLTEST_VARDIR/master-data/test/t7.frm ;
show tables from test;
show status like 'handler_discover%';
# Remove the frm file from disk again
flush tables;
system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm ;
remove_file $MYSQLTEST_VARDIR/master-data/test/t7.frm ;
--replace_column 7 # 8 # 9 # 12 # 13 # 15 # 18 #
show table status;
......@@ -204,13 +204,13 @@ system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 >> $NDB_TOOLS
#
# Test that correct error is returned
--error 1146
--error ER_NO_SUCH_TABLE
select * from t4;
--error 1146
--error ER_NO_SUCH_TABLE
select * from t4;
show status like 'handler_discover%';
--error 1051
--error ER_BAD_TABLE_ERROR
drop table t4;
create table t4(
......@@ -223,14 +223,14 @@ select * from t4;
# Remove the table from NDB
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 >> $NDB_TOOLS_OUTPUT ;
--error 1146
--error ER_NO_SUCH_TABLE
select * from t4;
drop table if exists t4;
# Test that dropping a table that does not exists
# on disk or in NDB gives same result as above
--error 1051
--error ER_BAD_TABLE_ERROR
drop table t5;
drop table if exists t5;
......@@ -257,7 +257,7 @@ system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 >> $NDB_TOOLS
SHOW TABLES;
--error 1146
--error ER_NO_SUCH_TABLE
select * from t4;
#######################################################
......@@ -290,8 +290,8 @@ insert into t9 values (9);
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 >> $NDB_TOOLS_OUTPUT ;
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 >> $NDB_TOOLS_OUTPUT ;
# Remove t6, t7 from disk
system rm $MYSQLTEST_VARDIR/master-data/test/t6.frm > /dev/null ;
system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm > /dev/null ;
remove_file $MYSQLTEST_VARDIR/master-data/test/t6.frm;
remove_file $MYSQLTEST_VARDIR/master-data/test/t7.frm;
SHOW TABLES;
......@@ -332,8 +332,8 @@ insert into t9 values (9);
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 > /dev/null ;
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 > /dev/null ;
# Remove t6, t7 from disk
system rm $MYSQLTEST_VARDIR/master-data/test/t6.frm > /dev/null ;
system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm > /dev/null ;
remove_file $MYSQLTEST_VARDIR/master-data/test/t6.frm;
remove_file $MYSQLTEST_VARDIR/master-data/test/t7.frm;
SHOW TABLES LIKE 't6';
......@@ -342,9 +342,9 @@ show status like 'handler_discover%';
# Check that t3 or t5 can't be created
# frm files for these tables is stilll on disk
--error 1050
--error ER_TABLE_EXISTS_ERROR
create table t3(a int);
--error 1050
--error ER_TABLE_EXISTS_ERROR
create table t5(a int);
SHOW TABLES LIKE 't%';
......@@ -375,9 +375,9 @@ insert into t3 values (3, "ndb table 3");
insert into t4 values (4);
# Remove t1, t2, t3 from disk
system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm > /dev/null ;
system rm $MYSQLTEST_VARDIR/master-data/test/t2.frm > /dev/null ;
system rm $MYSQLTEST_VARDIR/master-data/test/t3.frm > /dev/null ;
remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm;
remove_file $MYSQLTEST_VARDIR/master-data/test/t2.frm;
remove_file $MYSQLTEST_VARDIR/master-data/test/t3.frm;
flush tables;
# Select from the table which only exists in NDB.
......@@ -462,7 +462,7 @@ show tables;
create database test2;
use test2;
show tables;
--error 1146
--error ER_NO_SUCH_TABLE
select * from t1;
create table t2 (b int,c longblob) engine=ndb;
use test;
......@@ -487,7 +487,7 @@ create table t1 (a int primary key) engine=ndb;
select * from t1;
--exec $NDB_MGM --no-defaults -e "all restart -n" > /dev/null
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --not-started > /dev/null
--error 1015
--error ER_CANT_LOCK
select * from t1;
--exec $NDB_MGM --no-defaults -e "all start" > /dev/null
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults > /dev/null
......@@ -503,17 +503,17 @@ drop database test_only_ndb_tables;
# discovered( for example a table created via NDBAPI)
# Test disabled since it doesn't work on case insensitive systems
#--error 1050
#--error ER_TABLE_EXISTS_ERROR
#CREATE TABLE sys.SYSTAB_0 (a int);
#--error 1105
#--error ER_UNKNOWN_ERROR
#select * from sys.SYSTAB_0;
#CREATE TABLE IF NOT EXISTS sys.SYSTAB_0 (a int);
#show warnings;
#--error 1105
#--error ER_UNKNOWN_ERROR
#select * from sys.SYSTAB_0;
#--error 1051
#--error ER_BAD_TABLE_ERROR
#drop table sys.SYSTAB_0;
#drop table IF EXISTS sys.SYSTAB_0;
......@@ -531,7 +531,7 @@ CREATE TABLE t9 (
insert t9 values(1, 2), (2,3), (3, 4), (4, 5);
#Don't drop the table, instead remove the frm file
system rm $MYSQLTEST_VARDIR/master-data/test/t9.frm ;
remove_file $MYSQLTEST_VARDIR/master-data/test/t9.frm ;
# Now leave test case, when ndb_autodiscover2 will run, this
# MySQL Server will have been restarted because it has a
......
......@@ -25,7 +25,7 @@ create table t1(a int) engine=ndb;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
select count(*) from t1;
system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile ;
remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile ;
drop table t1;
create table t1(a int) engine=myisam;
......@@ -37,7 +37,7 @@ drop table t1;
create table t1(a int primary key) engine=ndb;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile;
remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile;
select * from t1 order by a;
drop table t1;
......@@ -50,7 +50,7 @@ drop table t1;
create table t1(a int primary key) engine=ndb;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile;
remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile;
select * from t1 order by a;
drop table t1;
......@@ -63,7 +63,7 @@ drop table t1;
create table t1(a int primary key) engine=ndb;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile;
remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile;
select * from t1 order by a;
drop table t1;
......
......@@ -134,10 +134,14 @@ insert into t4 values (1,31),(2,32),(3,33),(4,34),(5,35);
--let ndb_restore_filter=test t1
--source include/ndb_backup_print.inc
--exec rm -f $MYSQLTEST_VARDIR/tmp/t1.txt
--exec rm -f $MYSQLTEST_VARDIR/tmp/t2.txt
--exec rm -f $MYSQLTEST_VARDIR/tmp/t3.txt
--exec rm -f $MYSQLTEST_VARDIR/tmp/t4.txt
--error 0,1
--remove_file $MYSQLTEST_VARDIR/tmp/t1.txt
--error 0,1
--remove_file $MYSQLTEST_VARDIR/tmp/t2.txt
--error 0,1
--remove_file $MYSQLTEST_VARDIR/tmp/t3.txt
--error 0,1
--remove_file $MYSQLTEST_VARDIR/tmp/t4.txt
--let ndb_restore_opts=--verbose=0 --print_data --hex --tab $MYSQLTEST_VARDIR/tmp --append
--let ndb_restore_filter=test
......@@ -156,10 +160,10 @@ insert into t4 values (1,31),(2,32),(3,33),(4,34),(5,35);
--source include/show_msg.inc
--exec sort $MYSQLTEST_VARDIR/tmp/t4.txt
--exec rm -f $MYSQLTEST_VARDIR/tmp/t1.txt
--exec rm -f $MYSQLTEST_VARDIR/tmp/t2.txt
--exec rm -f $MYSQLTEST_VARDIR/tmp/t3.txt
--exec rm -f $MYSQLTEST_VARDIR/tmp/t4.txt
--remove_file $MYSQLTEST_VARDIR/tmp/t1.txt
--remove_file $MYSQLTEST_VARDIR/tmp/t2.txt
--remove_file $MYSQLTEST_VARDIR/tmp/t3.txt
--remove_file $MYSQLTEST_VARDIR/tmp/t4.txt
# now test some other datatypes
drop table t1;
......
......@@ -31,13 +31,13 @@ select load_file(concat(@tmpdir,"/outfile-test.3"));
# the following should give errors
disable_query_log;
--error 1086
--error ER_FILE_EXISTS_ERROR
eval select * into outfile "../tmp/outfile-test.1" from t1;
--error 1086
--error ER_FILE_EXISTS_ERROR
eval select * into dumpfile "../tmp/outfile-test.2" from t1;
--error 1086
--error ER_FILE_EXISTS_ERROR
eval select * into dumpfile "../tmp/outfile-test.3" from t1;
enable_query_log;
select load_file(concat(@tmpdir,"/outfile-test.not-exist"));
......@@ -92,7 +92,7 @@ use test;
# It should not be possible to write to a file outside of vardir
create table t1(a int);
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--error 1290
--error ER_OPTION_PREVENTS_STATEMENT
eval select * into outfile "$MYSQL_TEST_DIR/outfile-test1" from t1;
drop table t1;
......@@ -105,7 +105,7 @@ create user user_1@localhost;
grant all on mysqltest.* to user_1@localhost;
connect (con28181_1,localhost,user_1,,mysqltest);
--error 1044
--error ER_DBACCESS_DENIED_ERROR
eval select schema_name
into outfile "../tmp/outfile-test.4"
fields terminated by ',' optionally enclosed by '"'
......@@ -125,7 +125,7 @@ from information_schema.schemata
where schema_name like 'mysqltest';
connection default;
--exec rm $MYSQLTEST_VARDIR/tmp/outfile-test.4
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
use test;
revoke all privileges on *.* from user_1@localhost;
drop user user_1@localhost;
......
......@@ -6,9 +6,11 @@
source include/master-slave.inc;
create table t1 (a int) engine=myisam;
flush tables;
system rm $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYI
drop table if exists t1;
save_master_pos;
connection slave;
......@@ -22,7 +24,7 @@ set sql_log_bin=0;
insert into t1 values(2);
set sql_log_bin=1;
save_master_pos;
--error 1062
--error ER_DUP_ENTRY
insert into t1 values(1),(2);
drop table t1;
save_master_pos;
......
......@@ -25,7 +25,7 @@ eval select * into outfile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.sele
truncate table t1;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1;
system rm $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile ;
--remove_file $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile
save_master_pos;
connection slave;
sync_with_master;
......@@ -52,7 +52,7 @@ drop table t1;
create table t1(a int primary key);
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1;
system rm $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile ;
remove_file $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile ;
select * from t1;
save_master_pos;
connection slave;
......
......@@ -2173,6 +2173,14 @@ begin
end loop;
end|
CREATE TABLE t1 (a INT)|
INSERT INTO t1 VALUES (1),(2)|
CREATE PROCEDURE p1(a INT) BEGIN END|
--error ER_SUBQUERY_NO_1_ROW
CALL p1((SELECT * FROM t1))|
DROP PROCEDURE IF EXISTS p1|
DROP TABLE t1|
delimiter ;|
#
......
......@@ -7818,6 +7818,24 @@ drop function f1;
drop view v1;
drop table t1;
#
# Bug#38469 invalid memory read and/or crash with utf8 text field, stored procedure, uservar
#
delimiter $;
--disable_warnings
drop procedure if exists `p2` $
--enable_warnings
create procedure `p2`(in `a` text charset utf8)
begin
declare `pos` int default 1;
declare `str` text charset utf8;
set `str` := `a`;
select substr(`str`, `pos`+ 1 ) into `str`;
end $
delimiter ;$
call `p2`('s s s s s s');
drop procedure `p2`;
--echo # ------------------------------------------------------------------
--echo # -- End of 5.0 tests
--echo # ------------------------------------------------------------------
......@@ -80,7 +80,7 @@ create database mysqltest;
create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="/this-dir-does-not-exist";
# temporarily disabled as it returns different result in the embedded server
# --error 1210, 1210
# --error ER_WRONG_ARGUMENTS,ER_WRONG_ARGUMENTS
# create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="not-hard-path";
# Should fail becasue the file t9.MYI already exist in 'run'
......@@ -185,7 +185,12 @@ drop table t1;
#
# Protect ourselves from data left in tmp/ by a previos possibly failed
# test
--system rm -f $MYSQLTEST_VARDIR/tmp/t1.*
--error 0,1
--remove_file $MYSQLTEST_VARDIR/tmp/t1.frm
--error 0,1
--remove_file $MYSQLTEST_VARDIR/tmp/t1.MYD
--error 0,1
--remove_file $MYSQLTEST_VARDIR/tmp/t1.MYI
--disable_query_log
eval prepare stmt from "create table t1 (c char(10)) data directory='$MYSQLTEST_VARDIR/tmp'";
--enable_query_log
......@@ -203,19 +208,19 @@ deallocate prepare stmt;
# Bug#32167 another privilege bypass with DATA/INDEX DIRECORY
#
--replace_result $MYSQL_TEST_DIR TEST_DIR
--error 1,1210
--error 1,ER_WRONG_ARGUMENTS
eval CREATE TABLE t1(a INT)
DATA DIRECTORY='$MYSQL_TEST_DIR/var/master-data/test';
--replace_result $MYSQL_TEST_DIR TEST_DIR
--error 1,1210
--error 1,ER_WRONG_ARGUMENTS
eval CREATE TABLE t1(a INT)
DATA DIRECTORY='$MYSQL_TEST_DIR/var/master-data/';
--replace_result $MYSQL_TEST_DIR TEST_DIR
--error 1,1210
--error 1,ER_WRONG_ARGUMENTS
eval CREATE TABLE t1(a INT)
INDEX DIRECTORY='$MYSQL_TEST_DIR/var/master-data';
--replace_result $MYSQL_TEST_DIR TEST_DIR
--error 1,1210
--error 1,ER_WRONG_ARGUMENTS
eval CREATE TABLE t1(a INT)
INDEX DIRECTORY='$MYSQL_TEST_DIR/var/master-data_var';
......
......@@ -272,6 +272,8 @@ if [ $BASE_SYSTEM != "netware" ] ; then
if [ -d man ] ; then
$CP man/*.1 $BASE/man/man1
$CP man/*.8 $BASE/man/man8
# In a Unix binary package, these tools and their manuals are not useful
rm -f $BASE/man/man1/make_win_*
fi
fi
......@@ -331,6 +333,7 @@ fi
rm -f $BASE/bin/Makefile* $BASE/bin/*.in $BASE/bin/*.sh \
$BASE/bin/mysql_install_db $BASE/bin/make_binary_distribution \
$BASE/bin/make_win_* \
$BASE/bin/setsomevars $BASE/support-files/Makefile* \
$BASE/support-files/*.sh
......
......@@ -6992,8 +6992,18 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
return 0;
}
if (from == value.ptr())
/*
If the 'from' address is in the range of the temporary 'value'-
object we need to copy the content to a different location or it will be
invalidated when the 'value'-object is reallocated to make room for
the new character set.
*/
if (from >= value.ptr() && from <= value.ptr()+value.length())
{
/*
If content of the 'from'-address is cached in the 'value'-object
it is possible that the content needs a character conversion.
*/
uint32 dummy_offset;
if (!String::needs_conversion(length, cs, field_charset, &dummy_offset))
{
......
......@@ -1213,8 +1213,16 @@ class Field_varstring :public Field_longstr {
class Field_blob :public Field_longstr {
protected:
/**
The number of bytes used to represent the length of the blob.
*/
uint packlength;
String value; // For temporaries
/**
The 'value'-object is a cache fronting the storage engine.
*/
String value;
public:
Field_blob(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
......
......@@ -21,6 +21,9 @@
#include <my_sys.h>
#include <my_dir.h>
/* from sql_db.cc */
extern long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, const char *org_path);
/*
write string with escaping
......@@ -265,8 +268,9 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name,
DBUG_RETURN(TRUE);
}
// archive copies management
path[path_end]='\0';
#ifdef FRM_ARCHIVE
// archive copies management: disabled unused feature (see bug #17823).
if (!access(path, F_OK))
{
if (old_version != ULONGLONG_MAX && max_versions != 0)
......@@ -313,6 +317,7 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name,
}
}
}
#endif//FRM_ARCHIVE
{
// rename temporary file
......@@ -337,6 +342,7 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name,
SYNOPSIS
rename_in_schema_file
thd thread handler
schema name of given schema
old_name original file name
new_name new file name
......@@ -348,7 +354,8 @@ sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name,
1 - Error (only if renaming of frm failed)
*/
my_bool rename_in_schema_file(const char *schema, const char *old_name,
my_bool rename_in_schema_file(THD *thd,
const char *schema, const char *old_name,
const char *new_name, ulonglong revision,
uint num_view_backups)
{
......@@ -365,10 +372,11 @@ my_bool rename_in_schema_file(const char *schema, const char *old_name,
if (my_rename(old_path, new_path, MYF(MY_WME)))
return 1;
/* check if arc_dir exists */
/* check if arc_dir exists: disabled unused feature (see bug #17823). */
strxnmov(arc_path, FN_REFLEN, mysql_data_home, "/", schema, "/arc", NullS);
(void) unpack_filename(arc_path, arc_path);
#ifdef FRM_ARCHIVE
if (revision > 0 && !access(arc_path, F_OK))
{
ulonglong limit= ((revision > num_view_backups) ?
......@@ -384,6 +392,16 @@ my_bool rename_in_schema_file(const char *schema, const char *old_name,
my_rename(old_path, new_path, MYF(0));
}
}
#else//FRM_ARCHIVE
{ // remove obsolete 'arc' directory and files if any
MY_DIR *new_dirp;
if ((new_dirp = my_dir(arc_path, MYF(MY_DONT_SORT))))
{
DBUG_PRINT("my",("Archive subdir found: %s", arc_path));
(void) mysql_rm_arc_files(thd, new_dirp, arc_path);
}
}
#endif//FRM_ARCHIVE
return 0;
}
......
......@@ -82,8 +82,9 @@ my_bool
sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name,
const LEX_STRING *type,
gptr base, File_option *parameters, uint versions);
my_bool rename_in_schema_file(const char *schema, const char *old_name,
const char *new_name, ulonglong revision,
my_bool rename_in_schema_file(THD *thd,
const char *schema, const char *old_name,
const char *new_name, ulonglong revision,
uint num_view_backups);
class File_parser: public Sql_alloc
......
......@@ -1765,7 +1765,11 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
we'll leave it here.
*/
if (!thd->in_sub_stmt)
close_thread_tables(thd, 0, 0);
{
thd->lex->unit.cleanup();
close_thread_tables(thd);
thd->rollback_item_tree_changes();
}
DBUG_PRINT("info",(" %.*s: eval args done", m_name.length, m_name.str));
}
......
......@@ -974,6 +974,12 @@ sql_exchange::sql_exchange(char *name,bool flag)
cs= NULL;
}
bool sql_exchange::escaped_given(void)
{
return escaped != &default_escaped;
}
bool select_send::send_fields(List<Item> &list, uint flags)
{
bool res;
......@@ -1234,8 +1240,11 @@ select_export::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
exchange->line_term=exchange->field_term; // Use this if it exists
field_sep_char= (exchange->enclosed->length() ?
(int) (uchar) (*exchange->enclosed)[0] : field_term_char);
escape_char= (exchange->escaped->length() ?
(int) (uchar) (*exchange->escaped)[0] : -1);
if (exchange->escaped->length() && (exchange->escaped_given() ||
!(thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES)))
escape_char= (int) (uchar) (*exchange->escaped)[0];
else
escape_char= -1;
is_ambiguous_field_sep= test(strchr(ESCAPE_CHARS, field_sep_char));
is_unsafe_field_sep= test(strchr(NUMERIC_CHARS, field_sep_char));
line_sep_char= (exchange->line_term->length() ?
......
......@@ -1896,6 +1896,7 @@ class sql_exchange :public Sql_alloc
ulong skip_lines;
CHARSET_INFO *cs;
sql_exchange(char *name,bool dumpfile_flag);
bool escaped_given(void);
};
#include "log_event.h"
......
......@@ -35,7 +35,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp,
const char *db, const char *path, uint level,
TABLE_LIST **dropped_tables);
static long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, const char *org_path);
long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, const char *org_path);
static my_bool rm_dir_w_symlink(const char *org_path, my_bool send_error);
/* Database options hash */
static HASH dboptions;
......@@ -906,7 +906,11 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
else if (file->name[0] == 'a' && file->name[1] == 'r' &&
file->name[2] == 'c' && file->name[3] == '\0')
{
/* .frm archive */
/* .frm archive:
Those archives are obsolete, but following code should
exist to remove existent "arc" directories.
See #ifdef FRM_ARCHIVE directives for obsolete code.
*/
char newpath[FN_REFLEN];
MY_DIR *new_dirp;
strxmov(newpath, org_path, "/", "arc", NullS);
......@@ -1061,9 +1065,13 @@ static my_bool rm_dir_w_symlink(const char *org_path, my_bool send_error)
RETURN
> 0 number of removed files
-1 error
NOTE
A support of "arc" directories is obsolete, however this
function should exist to remove existent "arc" directories.
See #ifdef FRM_ARCHIVE directives for obsolete code.
*/
static long mysql_rm_arc_files(THD *thd, MY_DIR *dirp,
const char *org_path)
long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, const char *org_path)
{
long deleted= 0;
ulong found_other_files= 0;
......@@ -1105,6 +1113,7 @@ static long mysql_rm_arc_files(THD *thd, MY_DIR *dirp,
{
goto err;
}
deleted++;
}
if (thd->killed)
goto err;
......
......@@ -325,7 +325,9 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
bzero((char*) &info,sizeof(info));
info.ignore= ignore;
info.handle_duplicates=handle_duplicates;
info.escape_char=escaped->length() ? (*escaped)[0] : INT_MAX;
info.escape_char= (escaped->length() && (ex->escaped_given() ||
!(thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES)))
? (*escaped)[0] : INT_MAX;
READ_INFO read_info(file,tot_length,
ex->cs ? ex->cs : thd->variables.collation_database,
......
......@@ -1858,7 +1858,7 @@ mysql_rename_view(THD *thd,
goto err;
/* rename view and it's backups */
if (rename_in_schema_file(view->db, view->table_name, new_name,
if (rename_in_schema_file(thd, view->db, view->table_name, new_name,
view_def.revision - 1, num_view_backups))
goto err;
......@@ -1877,7 +1877,7 @@ mysql_rename_view(THD *thd,
num_view_backups))
{
/* restore renamed view in case of error */
rename_in_schema_file(view->db, new_name, view->table_name,
rename_in_schema_file(thd, view->db, new_name, view->table_name,
view_def.revision - 1, num_view_backups);
goto err;
}
......
......@@ -261,6 +261,7 @@ void write_core(int sig)
#else /* __WIN__*/
#include <dbghelp.h>
#include <tlhelp32.h>
/*
Stack tracing on Windows is implemented using Debug Helper library(dbghelp.dll)
......@@ -349,6 +350,68 @@ void set_exception_pointers(EXCEPTION_POINTERS *ep)
exception_ptrs = ep;
}
/*
Get symbol path - semicolon-separated list of directories to search for debug
symbols. We expect PDB in the same directory as corresponding exe or dll,
so the path is build from directories of the loaded modules. If environment
variable _NT_SYMBOL_PATH is set, it's value appended to the symbol search path
*/
static void get_symbol_path(char *path, size_t size)
{
HANDLE hSnap;
char *envvar;
path[0]= '\0';
/*
Enumerate all modules, and add their directories to the path.
Avoid duplicate entries.
*/
hSnap= CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetCurrentProcessId());
if (hSnap != INVALID_HANDLE_VALUE)
{
BOOL ret;
MODULEENTRY32 mod;
mod.dwSize= sizeof(MODULEENTRY32);
for (ret= Module32First(hSnap, &mod); ret; ret= Module32Next(hSnap, &mod))
{
char *module_dir= mod.szExePath;
char *p= strrchr(module_dir,'\\');
if (!p)
{
/*
Path separator was not found. Not known to happen, if ever happens,
will indicate current directory.
*/
module_dir[0]= '.';
p= module_dir + 1;
}
*p++= ';';
*p= '\0';
if (!strstr(path, module_dir))
{
size_t dir_len = strlen(module_dir);
if (size > dir_len)
{
strncat(path, module_dir, size-1);
size -= dir_len;
}
}
}
CloseHandle(hSnap);
}
/* Add _NT_SYMBOL_PATH, if present. */
envvar= getenv("_NT_SYMBOL_PATH");
if(envvar && size)
{
strncat(path, envvar, size-1);
}
}
#define MAX_SYMBOL_PATH 32768
/* Platform SDK in VS2003 does not have definition for SYMOPT_NO_PROMPTS*/
#ifndef SYMOPT_NO_PROMPTS
#define SYMOPT_NO_PROMPTS 0
......@@ -365,6 +428,7 @@ void print_stacktrace(gptr unused1, ulong unused2)
int i;
CONTEXT context;
STACKFRAME64 frame={0};
static char symbol_path[MAX_SYMBOL_PATH];
if(!exception_ptrs || !init_dbghelp_functions())
return;
......@@ -373,7 +437,8 @@ void print_stacktrace(gptr unused1, ulong unused2)
context = *(exception_ptrs->ContextRecord);
/*Initialize symbols.*/
pSymSetOptions(SYMOPT_LOAD_LINES|SYMOPT_NO_PROMPTS|SYMOPT_DEFERRED_LOADS|SYMOPT_DEBUG);
pSymInitialize(hProcess,NULL,TRUE);
get_symbol_path(symbol_path, sizeof(symbol_path));
pSymInitialize(hProcess, symbol_path, TRUE);
/*Prepare stackframe for the first StackWalk64 call*/
frame.AddrFrame.Mode= frame.AddrPC.Mode= frame.AddrStack.Mode= AddrModeFlat;
......
......@@ -591,6 +591,7 @@ fi
%doc %attr(644, root, root) %{_infodir}/mysql.info*
%doc %attr(644, root, man) %{_mandir}/man1/innochecksum.1*
%doc %attr(644, root, man) %{_mandir}/man1/my_print_defaults.1*
%doc %attr(644, root, man) %{_mandir}/man1/myisam_ftdump.1*
%doc %attr(644, root, man) %{_mandir}/man1/myisamchk.1*
......@@ -610,6 +611,7 @@ fi
%doc %attr(644, root, man) %{_mandir}/man1/mysqltest.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_tzinfo_to_sql.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_zap.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqlbug.1*
%doc %attr(644, root, man) %{_mandir}/man1/perror.1*
%doc %attr(644, root, man) %{_mandir}/man1/replace.1*
%doc %attr(644, root, man) %{_mandir}/man1/safe_mysqld.1*
......@@ -617,6 +619,7 @@ fi
%ghost %config(noreplace,missingok) %{_sysconfdir}/my.cnf
%ghost %config(noreplace,missingok) %{_sysconfdir}/mysqlmanager.passwd
%attr(755, root, root) %{_bindir}/innochecksum
%attr(755, root, root) %{_bindir}/my_print_defaults
%attr(755, root, root) %{_bindir}/myisam_ftdump
%attr(755, root, root) %{_bindir}/myisamchk
......@@ -661,6 +664,7 @@ fi
%attr(755, root, root) %{_bindir}/mysql
%attr(755, root, root) %{_bindir}/mysql_find_rows
%attr(755, root, root) %{_bindir}/mysql_tableinfo
%attr(755, root, root) %{_bindir}/mysql_upgrade_shell
%attr(755, root, root) %{_bindir}/mysql_waitpid
%attr(755, root, root) %{_bindir}/mysqlaccess
%attr(755, root, root) %{_bindir}/mysqladmin
......@@ -672,6 +676,8 @@ fi
%doc %attr(644, root, man) %{_mandir}/man1/msql2mysql.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_find_rows.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_tableinfo.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqlaccess.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqladmin.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqlbinlog.1*
......@@ -713,6 +719,8 @@ fi
%doc %attr(644, root, man) %{_mandir}/man1/ndb_config.1*
%doc %attr(644, root, man) %{_mandir}/man1/ndb_desc.1*
%doc %attr(644, root, man) %{_mandir}/man1/ndb_error_reporter.1*
%doc %attr(644, root, man) %{_mandir}/man1/ndb_mgm.1*
%doc %attr(644, root, man) %{_mandir}/man1/ndb_restore.1*
%doc %attr(644, root, man) %{_mandir}/man1/ndb_select_all.1*
%doc %attr(644, root, man) %{_mandir}/man1/ndb_select_count.1*
%doc %attr(644, root, man) %{_mandir}/man1/ndb_show_tables.1*
......@@ -724,13 +732,16 @@ fi
%attr(755, root, root) %{_bindir}/ndb_delete_all
%attr(755, root, root) %{_bindir}/ndb_drop_index
%attr(755, root, root) %{_bindir}/ndb_drop_table
%attr(755, root, root) %{_sbindir}/ndb_cpcd
%doc %attr(644, root, man) %{_mandir}/man1/ndb_delete_all.1*
%doc %attr(644, root, man) %{_mandir}/man1/ndb_drop_index.1*
%doc %attr(644, root, man) %{_mandir}/man1/ndb_drop_table.1*
%doc %attr(644, root, man) %{_mandir}/man1/ndb_cpcd.1*
%files devel
%defattr(-, root, root, 0755)
%doc EXCEPTIONS-CLIENT
%doc %attr(644, root, man) %{_mandir}/man1/comp_err.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_config.1*
%attr(755, root, root) %{_bindir}/comp_err
%attr(755, root, root) %{_bindir}/mysql_config
......@@ -784,6 +795,18 @@ fi
# itself - note that they must be ordered by date (important when
# merging BK trees)
%changelog
* Mon Aug 18 2008 Joerg Bruehe <joerg@mysql.com>
- Get rid of the "warning: Installed (but unpackaged) file(s) found:"
Some files were missing:
- Manual "mysqlbug" ("server" subpackage)
- Program "innochecksum" and its manual ("server" subpackage)
- Manuals "mysql_find_rows" + "mysql_tableinfo" ("client" subpackage)
- Script "mysql_upgrade_shell" ("client" subpackage)
- Manual "comp_err" ("devel" subpackage)
- Program "ndb_cpcd" and its manual ("ndb-extra" subpackage)
- Manuals "ndb_mgm" + "ndb_restore" ("ndb-tools" subpackage)
* Wed Mar 19 2008 Joerg Bruehe <joerg@mysql.com>
- Add the man pages for "ndbd" and "ndb_mgmd".
......
......@@ -31,7 +31,17 @@ try
var end= supp_version.indexOf("-");
if (end == -1) end= supp_version.length;
var app_version= supp_version.substring(0, end);
app_version+= ".0";
var fourth_element= 0;
if(app_version.match(/[a-z]$/)) {
fourth_element+= (1 + app_version.charCodeAt(end-1) - "a".charCodeAt(0));
app_version= app_version.substring(0,--end);
}
if(app_version.match(/sp[1-9]$/)) {
fourth_element+= 100*(app_version.charCodeAt(end-1) - "0".charCodeAt(0));
app_version= app_version.substring(0, end-3);
end-= 3;
}
app_version+= "." + fourth_element;
break;
case "arch":
var app_arch= parts[1];
......
......@@ -7,10 +7,10 @@
/* @(#) $Id$ */
#include "zutil.h"
#include <stdio.h>
#include "zutil.h"
#ifdef NO_DEFLATE /* for compatibility with old definition */
# define NO_GZCOMPRESS
#endif
......
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