You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.2 KiB

  1. #
  2. # Test of auto_increment
  3. # BUG#11932
  4. #
  5. # Bug reported that master and slave get out of sync after TRUNCATE
  6. # TABLE.
  7. #
  8. # Test supplied by Are Casilla
  9. source include/master-slave.inc;
  10. --disable_warnings
  11. connection master;
  12. drop database if exists test1;
  13. --enable_warnings
  14. create database test1;
  15. use test1;
  16. CREATE TABLE `t1` (
  17. `id` int(10) unsigned NOT NULL auto_increment,
  18. `fname` varchar(100) default NULL,
  19. PRIMARY KEY (`id`)
  20. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
  21. INSERT INTO `t1` VALUES (1, 'blablabla');
  22. CREATE TABLE `t2` (
  23. `id` int(10) NOT NULL auto_increment,
  24. `comment` varchar(255) NOT NULL default '',
  25. PRIMARY KEY (`id`)
  26. ) ENGINE=MyISAM AUTO_INCREMENT=3 ;
  27. INSERT INTO `t2` VALUES (1, 'testtest 1');
  28. INSERT INTO `t2` VALUES (2, 'test 2');
  29. DELIMITER $;
  30. CREATE PROCEDURE simpleproc3 ()
  31. NOT DETERMINISTIC
  32. BEGIN
  33. INSERT INTO t1 (fname) (SELECT t2.comment FROM t2 WHERE t2.id = '1');
  34. INSERT INTO t1 (fname) VALUES('test');
  35. END
  36. $
  37. DELIMITER ;$
  38. CALL simpleproc3();
  39. select * from t2;
  40. TRUNCATE TABLE `t1`;
  41. CALL simpleproc3();
  42. select * from t1;
  43. save_master_pos;
  44. connection slave;
  45. sync_with_master;
  46. use test1;
  47. select * from t1;
  48. drop database test1;
  49. connection master;
  50. drop database test1;