SET STORAGE_ENGINE='Falcon';

#
# Mantis bug #192: Partitions: crash after a few alters
#
--echo *** Bug #192 ***
--disable_warnings
DROP PROCEDURE IF EXISTS falcon4.pf3;
DROP DATABASE IF EXISTS falcon4;
--enable_warnings

DELIMITER //;
CREATE DATABASE falcon4//
USE falcon4//
CREATE TABLE tf3 (
  s1 int, 
  s2 varchar(200)
)//

CREATE PROCEDURE pf3 () 
BEGIN 
  declare v int default 0; 
  while v < 2 
    do 
    alter table tf3 partition by range (s1) (partition p4 values less than maxvalue);
    alter table tf3 remove partitioning;
    set v = v + 1; 
  end while; 
END//

CALL falcon4.pf3()//

# Final cleanup
DELIMITER ;//
DROP PROCEDURE falcon4.pf3;
DROP DATABASE falcon4;
