--source include/have_falcon.inc

#
# Bug #40130: Falcon date / time indexes broken
#
--echo *** Bug #40130 ***

# ----------------------------------------------------- #
# --- Initialisation                                --- #
# ----------------------------------------------------- #
let $engine = 'Falcon';
eval SET @@storage_engine = $engine;

--disable_warnings
DROP TABLE IF EXISTS table10;
--enable_warnings

# ----------------------------------------------------- #
# --- Test                                          --- #
# ----------------------------------------------------- #

CREATE TABLE table10 (`time_key` time, key (`time_key` ));
INSERT INTO table10 VALUES ('23:43:55');
INSERT INTO table10 VALUES ('03:18:59');
INSERT INTO table10 VALUES ('05:05:23');
INSERT INTO table10 VALUES ('09:20:40');
INSERT INTO table10 VALUES ('22:32:50');
INSERT INTO table10 VALUES ('07:41:31');
INSERT INTO table10 VALUES ('10:52:13');
INSERT INTO table10 VALUES ('12:40:54');
INSERT INTO table10 VALUES ('10:33:25');
INSERT INTO table10 VALUES ('22:11:46');

SET AUTOCOMMIT=OFF;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '09:11:23' WHERE `time_key` < '16:23:56'; 
INSERT INTO table10 VALUES ( '20:25:18' ); 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '10:33:25' WHERE `time_key` > '22:11:46'; 
INSERT INTO table10 VALUES ( '17:58:48' ); 
COMMIT;

START TRANSACTION; 
INSERT INTO table10 VALUES ( '00:16:10' ); 
UPDATE table10 SET `time_key` = '16:05:35' WHERE `time_key` > '16:57:24'; 
COMMIT;

START TRANSACTION; 
INSERT INTO table10 VALUES ( '20:24:01' ); 
INSERT INTO table10 VALUES ( '18:37:59' ); 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '21:05:17' WHERE `time_key` < '06:07:07'; 
INSERT INTO table10 VALUES ( '00:05:40' ); 
COMMIT;

START TRANSACTION; 
INSERT INTO table10 VALUES ( '13:34:36' ); 
INSERT INTO table10 VALUES ( '22:35:15' ); 
COMMIT;

START TRANSACTION; 
INSERT INTO table10 VALUES ( '09:32:02' ); 
INSERT INTO table10 VALUES ( '12:02:39' ); 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '19:22:23' WHERE `time_key` < '03:39:55'; 
UPDATE table10 SET `time_key` = '13:45:38' WHERE `time_key` < '03:52:41'; 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '21:57:00' WHERE `time_key` < '11:37:04'; 
INSERT INTO table10 VALUES ( '18:56:03' ); 
COMMIT;

START TRANSACTION; 
INSERT INTO table10 VALUES ( '21:46:34' ); 
INSERT INTO table10 VALUES ( '00:46:37' ); 
COMMIT;

START TRANSACTION; 
INSERT INTO table10 VALUES ( '11:54:45' ); 
INSERT INTO table10 VALUES ( '11:00:16' ); 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '04:41:27' WHERE `time_key` > '05:45:30'; 
INSERT INTO table10 VALUES ( '05:55:02' ); 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '02:51:17' WHERE `time_key` < '05:33:58'; 
INSERT INTO table10 VALUES ( '06:07:14' ); 
COMMIT;

START TRANSACTION; 
INSERT INTO table10 VALUES ( '19:17:13' ); 
UPDATE table10 SET `time_key` = '14:23:25' WHERE `time_key` < '18:44:25'; 
COMMIT;

START TRANSACTION; 
INSERT INTO table10 VALUES ( '01:54:06' ); 
INSERT INTO table10 VALUES ( '05:36:42' ); 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '04:04:15' WHERE `time_key` < '17:09:11'; 
INSERT INTO table10 VALUES ( '13:22:58' ); 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '03:45:01' WHERE `time_key` < '01:02:29'; 
INSERT INTO table10 VALUES ( '14:45:34' ); 
COMMIT;

START TRANSACTION; 
INSERT INTO table10 VALUES ( '12:33:12' ); 
INSERT INTO table10 VALUES ( '21:40:27' ); 
COMMIT;

START TRANSACTION; 
INSERT INTO table10 VALUES ( '05:05:45' ); 
INSERT INTO table10 VALUES ( '01:21:15' ); 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '01:43:44' WHERE `time_key` > '18:44:54'; 
UPDATE table10 SET `time_key` = '16:00:25' WHERE `time_key` > '17:37:45'; 
COMMIT;

START TRANSACTION; 
INSERT INTO table10 VALUES ( '09:17:29' ); 
UPDATE table10 SET `time_key` = '00:32:27' WHERE `time_key` < '19:55:22'; 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '00:01:27' WHERE `time_key` < '23:49:20'; 
INSERT INTO table10 VALUES ( '11:10:06' ); 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '21:52:14' WHERE `time_key` > '00:54:57'; 
INSERT INTO table10 VALUES ( '10:32:20' ); 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '05:48:51' WHERE `time_key` < '05:53:48'; 
UPDATE table10 SET `time_key` = '04:11:47' WHERE `time_key` > '14:02:03'; 
COMMIT;

START TRANSACTION; 
INSERT INTO table10 VALUES ( '20:58:47' ); 
INSERT INTO table10 VALUES ( '06:58:04' ); 
COMMIT;

START TRANSACTION; 
INSERT INTO table10 VALUES ( '14:41:45' ); 
UPDATE table10 SET `time_key` = '00:45:47' WHERE `time_key` < '21:51:00'; 
COMMIT;

START TRANSACTION; 
INSERT INTO table10 VALUES ( '09:01:24' ); 
INSERT INTO table10 VALUES ( '07:07:37' ); 
COMMIT;

START TRANSACTION; 
INSERT INTO table10 VALUES ( '06:25:00' ); 
INSERT INTO table10 VALUES ( '05:47:01' ); 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '12:31:51' WHERE `time_key` > '04:34:05'; 
INSERT INTO table10 VALUES ( '01:31:26' ); 
COMMIT;

START TRANSACTION; 
INSERT INTO table10 VALUES ( '01:46:22' ); 
INSERT INTO table10 VALUES ( '01:14:58' ); 
COMMIT;

START TRANSACTION; 
INSERT INTO table10 VALUES ( '04:09:31' ); 
UPDATE table10 SET `time_key` = '08:28:13' WHERE `time_key` > '14:50:18'; 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '11:19:43' WHERE `time_key` < '04:30:14'; 
INSERT INTO table10 VALUES ( '20:03:24' ); 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '14:40:32' WHERE `time_key` < '15:30:08'; 
UPDATE table10 SET `time_key` = '03:13:02' WHERE `time_key` < '21:47:42'; 
COMMIT;

START TRANSACTION; 
INSERT INTO table10 VALUES ( '20:37:56' ); 
UPDATE table10 SET `time_key` = '15:51:19' WHERE `time_key` < '01:39:43'; 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '07:15:18' WHERE `time_key` > '05:37:40'; 
INSERT INTO table10 VALUES ( '18:47:30' ); 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '13:32:24' WHERE `time_key` > '23:38:12'; 
INSERT INTO table10 VALUES ( '23:32:39' ); 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '22:01:18' WHERE `time_key` < '17:51:48'; 
INSERT INTO table10 VALUES ( '11:41:29' ); 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '15:45:55' WHERE `time_key` > '04:03:52'; 
UPDATE table10 SET `time_key` = '05:43:47' WHERE `time_key` < '07:29:01'; 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '23:44:48' WHERE `time_key` < '00:33:42'; 
UPDATE table10 SET `time_key` = '08:56:04' WHERE `time_key` > '12:16:41'; 
COMMIT;

START TRANSACTION; 
INSERT INTO table10 VALUES ( '19:23:41' ); 
INSERT INTO table10 VALUES ( '18:44:20' ); 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '00:40:04' WHERE `time_key` > '11:34:06'; 
UPDATE table10 SET `time_key` = '23:45:59' WHERE `time_key` < '09:44:50'; 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '18:54:59' WHERE `time_key` < '15:46:02'; 
INSERT INTO table10 VALUES ( '17:37:41' ); 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '17:08:04' WHERE `time_key` < '14:11:50'; 
UPDATE table10 SET `time_key` = '21:33:59' WHERE `time_key` > '17:44:43'; 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '03:50:15' WHERE `time_key` > '19:35:18'; 
UPDATE table10 SET `time_key` = '23:15:47' WHERE `time_key` < '12:18:46'; 
COMMIT;

START TRANSACTION; 
INSERT INTO table10 VALUES ( '22:50:01' ); 
INSERT INTO table10 VALUES ( '17:29:53' ); 
COMMIT;

START TRANSACTION; 
INSERT INTO table10 VALUES ( '21:33:30' ); 
INSERT INTO table10 VALUES ( '06:27:52' ); 
COMMIT;

START TRANSACTION; 
INSERT INTO table10 VALUES ( '07:49:31' ); 
INSERT INTO table10 VALUES ( '21:31:25' );
COMMIT;

START TRANSACTION; 
INSERT INTO table10 VALUES ( '13:50:22' ); 
INSERT INTO table10 VALUES ( '15:13:07' ); 
COMMIT;

START TRANSACTION; 
INSERT INTO table10 VALUES ( '14:06:24' ); 
INSERT INTO table10 VALUES ( '19:10:11' ); 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '05:03:39' WHERE `time_key` > '11:46:31'; 
INSERT INTO table10 VALUES ( '04:35:34' );
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '14:37:01' WHERE `time_key` < '02:11:03'; 
INSERT INTO table10 VALUES ( '10:52:22' ); 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '15:37:40' WHERE `time_key` > '11:19:00'; 
INSERT INTO table10 VALUES ( '08:46:29' ); 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '07:59:59' WHERE `time_key` < '05:27:20'; 
UPDATE table10 SET `time_key` = '00:45:15' WHERE `time_key` < '20:07:08';
COMMIT;

START TRANSACTION; 
INSERT INTO table10 VALUES ( '00:51:31' ); 
UPDATE table10 SET `time_key` = '10:00:58' WHERE `time_key` < '16:41:45'; 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '13:49:37' WHERE `time_key` > '10:40:48'; 
INSERT INTO table10 VALUES ( '05:16:25' ); 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '14:46:15' WHERE `time_key` < '12:48:22'; 
UPDATE table10 SET `time_key` = '05:50:46' WHERE `time_key` < '07:58:43'; 
COMMIT;

START TRANSACTION; 
UPDATE table10 SET `time_key` = '00:11:06' WHERE `time_key` < '16:39:47'; 
UPDATE table10 SET `time_key` = '04:13:41' WHERE `time_key` < '14:55:39'; 
COMMIT;

SELECT * FROM table10;

START TRANSACTION;
UPDATE table10 SET `time_key` = '00:28:04' WHERE `time_key` < '09:58:46'; 
UPDATE table10 SET `time_key` = '04:56:25' WHERE `time_key` > '09:26:08'; 
COMMIT;

SELECT * FROM table10;

# ----------------------------------------------------- #
# --- Final cleanup                                 --- #
# ----------------------------------------------------- #
DROP TABLE table10;
