SET storage_engine = Falcon;
#
# Mantis bug #262: Crash creating temporary table
#
--echo *** Bug #262 ***
--disable_warnings
DROP DATABASE IF EXISTS test2;
--enable_warnings

CREATE DATABASE test2;
USE test2;

--echo # Establish connection conn1 (user = root)
connect (conn1,localhost,root,,);
SET storage_engine = Falcon;
USE test2;

--echo # Switch to connection default
connection default;
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (3), (0), (3);
SELECT count(*) FROM t1;

# Run this with --tmpdir=/tmp to crash Falcon change set 1.2282, 2006-09-05 
#--error 1005
#CREATE TEMPORARY TABLE t1 (a int, b int);
# End run this

CREATE TEMPORARY TABLE t1 (a int, b int);
INSERT INTO t1 VALUES (2, 3);
SELECT count(*) FROM t1;

--echo # Switch to connection conn1
connection conn1;
CREATE TEMPORARY TABLE t1 (a int, b int, c int);
INSERT INTO t1 VALUES (2, 3, 5), (5, 3, 2);
SELECT count(*) FROM t1;

--echo # Switch to connection default
connection default;
DROP TEMPORARY TABLE t1;
SELECT count(*) FROM t1;

--echo # Switch to connection conn1
connection conn1;
DROP TEMPORARY TABLE t1;
SELECT count(*) FROM t1;

# Final cleanup.
--echo # Switch to connection default
connection default;
disconnect conn1;
DROP DATABASE test2;
