SET storage_engine = Falcon;
#
# Bug #22939: Falcon: searches for negative numbers fail if index 
#             exists and partition
#
--echo *** Bug #22939 ***
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings

CREATE TABLE t1 (a int, key (a));

INSERT INTO t1 VALUES (-1);
INSERT INTO t1 VALUES (1);
SELECT * FROM t1 WHERE a < 0;
SELECT * FROM t1 WHERE a > 0;

ALTER TABLE t1 PARTITION BY RANGE (a) (
  PARTITION p1 VALUES LESS THAN (0),
  PARTITION p2 VALUES LESS THAN MAXVALUE
);
SELECT * FROM t1 WHERE a < 0;
SELECT * FROM t1 WHERE a > 0;

# Final cleanup.
DROP TABLE t1;
