Commit 0f85f6f7 authored by lars/lthalmann@dl145j.mysql.com's avatar lars/lthalmann@dl145j.mysql.com

Merge mysql.com:/users/lthalmann/bk/MERGE/mysql-5.0-merge

into  mysql.com:/users/lthalmann/bk/MERGE/mysql-5.1-merge
parents 57a74ea4 d20e3265
......@@ -2954,6 +2954,115 @@ drop user myDB_User;
drop database mysqldump_myDB;
use test;
End of 5.0 tests
#
# Bug #13926: --order-by-primary fails if PKEY contains quote character
#
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a b` INT,
`c"d` INT,
`e``f` INT,
PRIMARY KEY (`a b`, `c"d`, `e``f`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
insert into t1 values (0815, 4711, 2006);
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS "t1";
CREATE TABLE "t1" (
"a b" int(11) NOT NULL default '0',
"c""d" int(11) NOT NULL default '0',
"e`f" int(11) NOT NULL default '0',
PRIMARY KEY ("a b","c""d","e`f")
);
LOCK TABLES "t1" WRITE;
/*!40000 ALTER TABLE "t1" DISABLE KEYS */;
INSERT INTO "t1" VALUES (815,4711,2006);
/*!40000 ALTER TABLE "t1" ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a b` int(11) NOT NULL default '0',
`c"d` int(11) NOT NULL default '0',
`e``f` int(11) NOT NULL default '0',
PRIMARY KEY (`a b`,`c"d`,`e``f`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT INTO `t1` VALUES (815,4711,2006);
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE `t1`;
#
# End of 5.0 tests
#
create database mysqldump_myDB;
use mysqldump_myDB;
create user myDB_User;
grant create, create view, select, insert on mysqldump_myDB.* to myDB_User@localhost;
create table t1 (c1 int);
insert into t1 values (3);
use mysqldump_myDB;
create table u1 (f1 int);
insert into u1 values (4);
create view v1 (c1) as select * from t1;
use mysqldump_myDB;
drop view v1;
drop table t1;
drop table u1;
revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
drop user myDB_User;
drop database mysqldump_myDB;
flush privileges;
use mysqldump_myDB;
select * from mysqldump_myDB.v1;
c1
3
select * from mysqldump_myDB.u1;
f1
4
use mysqldump_myDB;
drop view v1;
drop table t1;
drop table u1;
revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
drop user myDB_User;
drop database mysqldump_myDB;
use test;
End of 5.0 tests
drop table if exists t1;
CREATE TABLE t1(a int, b int);
INSERT INTO t1 VALUES (1,1);
......@@ -3265,3 +3374,4 @@ drop view v1;
drop table t1;
drop database mysqldump_test_db;
End of 5.1 tests
......@@ -81,3 +81,18 @@ c
DROP VIEW v1;
DROP TABLE t1;
End of 5.0 tests
create table t1(a int, b int);
insert into t1 values (1, 1), (1, 2), (1, 3);
create view v1(a, b) as select a, sum(b) from t1 group by a;
explain v1;
Field Type Null Key Default Extra
a int(11) YES NULL
b decimal(32,0) YES NULL
show create table v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,sum(`t1`.`b`) AS `b` from `t1` group by `t1`.`a`
select * from v1;
a b
1 6
drop table t1;
drop view v1;
......@@ -155,22 +155,24 @@ drop database mysqldump_test_db;
CREATE TABLE t1 (a CHAR(10));
INSERT INTO t1 VALUES (_latin1 '');
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments test t1
#
# Bug#8063: make test mysqldump [ fail ]
# We cannot tes 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"
#
--echo #
--echo # Bug#8063: make test mysqldump [ fail ]
--echo # We cannot tes 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"
--echo #
#--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --compatible=mysql323 test t1
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --compatible=mysql323 --default-character-set=cp850 test t1
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=cp850 --compatible=mysql323 test t1
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=utf8 --compatible=mysql323 test t1
DROP TABLE t1;
#
# WL #2319: Exclude Tables from dump
#
--echo #
--echo # WL #2319: Exclude Tables from dump
--echo #
CREATE TABLE t1 (a int);
CREATE TABLE t2 (a int);
......@@ -180,9 +182,9 @@ INSERT INTO t2 VALUES (4),(5),(6);
DROP TABLE t1;
DROP TABLE t2;
#
# Bug #8830
#
--echo #
--echo # Bug #8830
--echo #
CREATE TABLE t1 (`b` blob);
INSERT INTO `t1` VALUES (0x602010000280100005E71A);
......@@ -200,10 +202,10 @@ INSERT INTO t1 VALUES (4),(5),(6);
--exec $MYSQL_DUMP --skip-comments --insert-ignore --delayed-insert test t1
DROP TABLE t1;
#
# Bug #10286: mysqldump -c crashes on table that has many fields with long
# 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,
......@@ -548,9 +550,9 @@ INSERT INTO t1 VALUES (1),(2),(3);
--exec $MYSQL_DUMP --add-drop-database --skip-comments --databases test
DROP TABLE t1;
#
# Bug #9558 mysqldump --no-data db t1 t2 format still dumps data
#
--echo #
--echo # Bug #9558 mysqldump --no-data db t1 t2 format still dumps data
--echo #
CREATE DATABASE mysqldump_test_db;
USE mysqldump_test_db;
......@@ -565,11 +567,11 @@ INSERT INTO t2 VALUES (1), (2);
DROP TABLE t1, t2;
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 \)
#
--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 #
create database mysqldump_test_db;
use mysqldump_test_db;
create table t1(a varchar(30) primary key, b int not null);
......@@ -641,9 +643,10 @@ 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;
#
# BUG #12123
#
--echo #
--echo # BUG #12123
--echo #
create table t1 (a text character set utf8, b text character set latin1);
insert t1 values (0x4F736E616272C3BC636B, 0x4BF66C6E);
select * from t1;
......@@ -654,15 +657,16 @@ select * from t1;
drop table t1;
#
# BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence
#
--echo #
--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
#
# BUG #19025 mysqldump doesn't correctly dump "auto_increment = [int]"
#
--echo #
--echo # BUG #19025 mysqldump doesn't correctly dump "auto_increment = [int]"
--echo #
create table `t1` (
t1_name varchar(255) default null,
t1_id int(10) unsigned not null auto_increment,
......@@ -689,9 +693,9 @@ show create table `t1`;
drop table `t1`;
#
# Bug #18536: wrong table order
#
--echo #
--echo # Bug #18536: wrong table order
--echo #
create table t1(a int);
create table t2(a int);
......@@ -700,9 +704,10 @@ create table t3(a int);
--exec $MYSQL_DUMP --skip-comments --force --no-data test t3 t1 non_existing t2
drop table t1, t2, t3;
#
# Bug #21288: mysqldump segmentation fault when using --where
#
--echo #
--echo # Bug #21288: mysqldump segmentation fault when using --where
--echo #
create table t1 (a int);
--error 2
--exec $MYSQL_DUMP --skip-comments --force test t1 --where='xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' 2>&1
......@@ -710,9 +715,9 @@ drop table t1;
--echo End of 4.1 tests
#
# Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X)
#
--echo #
--echo # Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X)
--echo #
create database db1;
use db1;
......@@ -734,9 +739,9 @@ drop view v2;
drop database db1;
use test;
#
# Bug 10713 mysqldump includes database in create view and referenced tables
#
--echo #
--echo # Bug 10713 mysqldump includes database in create view and referenced tables
--echo #
# create table and views in db2
create database db2;
......@@ -834,9 +839,9 @@ select v3.a from v3, v1 where v1.a=v3.a and v3.b=3 limit 1;
drop view v1, v2, v3;
drop table t1;
#
# Test for dumping triggers
#
--echo #
--echo # Test for dumping triggers
--echo #
CREATE TABLE t1 (a int, b bigint default NULL);
CREATE TABLE t2 (a int);
......@@ -894,9 +899,9 @@ DROP TABLE t1, t2;
--exec $MYSQL_MY_PRINT_DEFAULTS -e $MYSQLTEST_VARDIR/tmp/tmp.cnf mysqltest1 mysqltest1
--system rm $MYSQLTEST_VARDIR/tmp/tmp.cnf
#
# Test of fix to BUG 12597
#
--echo #
--echo # Test of fix to BUG 12597
--echo #
DROP TABLE IF EXISTS `test1`;
CREATE TABLE `test1` (
......@@ -932,9 +937,9 @@ DROP TRIGGER testref;
DROP TABLE test1;
DROP TABLE test2;
#
# BUG#9056 - mysqldump does not dump routines
#
--echo #
--echo # BUG#9056 - mysqldump does not dump routines
--echo #
--disable_warnings
DROP TABLE IF EXISTS t1;
......@@ -981,9 +986,10 @@ DROP PROCEDURE bug9056_proc2;
DROP PROCEDURE `a'b`;
drop table t1;
#
# BUG# 13052 - mysqldump timestamp reloads broken
#
--echo #
--echo # BUG# 13052 - mysqldump timestamp reloads broken
--echo #
--disable_warnings
drop table if exists t1;
--enable_warnings
......@@ -1003,9 +1009,10 @@ drop table t1;
set global time_zone=default;
set time_zone=default;
#
# Test of fix to BUG 13146 - ansi quotes break loading of triggers
#
--echo #
--echo # Test of fix to BUG 13146 - ansi quotes break loading of triggers
--echo #
--disable_warnings
DROP TABLE IF EXISTS `t1 test`;
DROP TABLE IF EXISTS `t2 test`;
......@@ -1036,9 +1043,9 @@ DROP TRIGGER `test trig`;
DROP TABLE `t1 test`;
DROP TABLE `t2 test`;
#
# BUG# 12838 mysqldump -x with views exits with error
#
--echo #
--echo # BUG# 12838 mysqldump -x with views exits with error
--echo #
--disable_warnings
drop table if exists t1;
......@@ -1059,10 +1066,10 @@ drop view v0;
drop view v1;
drop table t1;
#
# BUG#14554 - mysqldump does not separate words "ROW" and "BEGIN"
# for tables with trigger created in the IGNORE_SPACE sql mode.
#
--echo #
--echo # BUG#14554 - mysqldump does not separate words "ROW" and "BEGIN"
--echo # for tables with trigger created in the IGNORE_SPACE sql mode.
--echo #
SET @old_sql_mode = @@SQL_MODE;
SET SQL_MODE = IGNORE_SPACE;
......@@ -1083,18 +1090,19 @@ SET SQL_MODE = @old_sql_mode;
DROP TRIGGER tr1;
DROP TABLE t1;
#
# 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 ('','');
--exec $MYSQL_DUMP --skip-comments --skip-extended-insert --hex-blob test t1
--exec $MYSQL_DUMP --skip-comments --hex-blob test t1
drop table t1;
#
# Bug 14871 Invalid view dump output
#
--echo #
--echo # Bug 14871 Invalid view dump output
--echo #
create table t1 (a int);
insert into t1 values (289), (298), (234), (456), (789);
......@@ -1151,11 +1159,10 @@ drop trigger tr1;
drop trigger tr2;
drop table t1, t2;
--echo #
--echo # Bug#18462 mysqldump does not dump view structures correctly
--echo #
#
# Bug#18462 mysqldump does not dump view structures correctly
#
#
create table t (qty int, price int);
insert into t values(3, 50);
insert into t values(5, 51);
......@@ -1172,11 +1179,11 @@ drop view v2;
drop table t;
#
# Bug#14857 Reading dump files with single statement stored routines fails.
# fixed by patch for bug#16878
#
#
--echo #
--echo # Bug#14857 Reading dump files with single statement stored routines fails.
--echo # fixed by patch for bug#16878
--echo #
DELIMITER |;
/*!50003 CREATE FUNCTION `f`() RETURNS bigint(20)
return 42 */|
......@@ -1202,9 +1209,9 @@ drop table t1;
--echo } mysqldump
drop view v1;
# BUG#17201 Spurious 'DROP DATABASE' in output,
# also confusion between tables and views.
# Example code from Markus Popp
--echo # BUG#17201 Spurious 'DROP DATABASE' in output,
--echo # also confusion between tables and views.
--echo # Example code from Markus Popp
create database mysqldump_test_db;
use mysqldump_test_db;
......@@ -1219,9 +1226,10 @@ drop view v1;
drop table t1;
drop database mysqldump_test_db;
#
# Bug21014 Segmentation fault of mysqldump on view
#
--echo #
--echo # Bug21014 Segmentation fault of mysqldump on view
--echo #
create database mysqldump_tables;
use mysqldump_tables;
create table basetable ( id serial, tag varchar(64) );
......@@ -1237,9 +1245,10 @@ drop database mysqldump_views;
drop table mysqldump_tables.basetable;
drop database mysqldump_tables;
#
# Bug20221 Dumping of multiple databases containing view(s) yields maleformed dumps
#
--echo #
--echo # Bug20221 Dumping of multiple databases containing view(s) yields maleformed dumps
--echo #
create database mysqldump_dba;
use mysqldump_dba;
create table t1 (f1 int, f2 int);
......@@ -1277,9 +1286,9 @@ drop table t1;
drop database mysqldump_dbb;
use test;
#
# Bug#21215 mysqldump creating incomplete backups without warning
#
--echo #
--echo # Bug#21215 mysqldump creating incomplete backups without warning
--echo #
# Create user without sufficient privs to perform the requested operation
create user mysqltest_1@localhost;
......@@ -1321,12 +1330,12 @@ grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
drop table t1;
drop user mysqltest_1@localhost;
#
# Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the
# information_schema database.
#
# Bug #21424 mysqldump failing to export/import views
#
--echo #
--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 #
# Do as root
connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
......@@ -1360,8 +1369,10 @@ drop user myDB_User;
drop database mysqldump_myDB;
flush privileges;
# Bug #21424 continues from here.
# 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;
# Do as a user
......@@ -1383,7 +1394,28 @@ drop user myDB_User;
drop database mysqldump_myDB;
use test;
--echo End of 5.0 tests
--echo #
--echo # BUG#13926: --order-by-primary fails if PKEY contains quote character
--echo #
--disable_warnings
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a b` INT,
`c"d` INT,
`e``f` INT,
PRIMARY KEY (`a b`, `c"d`, `e``f`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
insert into t1 values (0815, 4711, 2006);
--exec $MYSQL_DUMP --skip-comments --compatible=ansi --order-by-primary test t1
--exec $MYSQL_DUMP --skip-comments --order-by-primary test t1
DROP TABLE `t1`;
--enable_warnings
--echo #
--echo # End of 5.0 tests
--echo #
# Check new --replace option
......@@ -1495,4 +1527,6 @@ drop view v1;
drop table t1;
drop database mysqldump_test_db;
--echo End of 5.1 tests
--echo #
--echo # End of 5.1 tests
--echo #
......@@ -132,4 +132,24 @@ DROP TABLE t1;
--sync_with_master
--connection master
#
# BUG#19419: "VIEW: View that the column name is different
# by master and slave is made".
#
connection master;
create table t1(a int, b int);
insert into t1 values (1, 1), (1, 2), (1, 3);
create view v1(a, b) as select a, sum(b) from t1 group by a;
sync_slave_with_master;
explain v1;
show create table v1;
select * from v1;
connection master;
drop table t1;
drop view v1;
sync_slave_with_master;
--echo End of 5.0 tests
......@@ -4912,6 +4912,19 @@ end_with_restore_list:
}
append_identifier(thd, &buff, first_table->table_name,
first_table->table_name_length);
if (lex->view_list.elements)
{
List_iterator_fast<LEX_STRING> names(lex->view_list);
LEX_STRING *name;
int i;
for (i= 0; name= names++; i++)
{
buff.append(i ? ", " : "(");
append_identifier(thd, &buff, name->str, name->length);
}
buff.append(')');
}
buff.append(STRING_WITH_LEN(" AS "));
buff.append(first_table->source.str, first_table->source.length);
......
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