--source include/have_falcon.inc
--source include/have_utf8.inc

SET STORAGE_ENGINE = Falcon;
#
# Bug #26057: Falcon: UTF8 searches for accented character fail if index exists
#
--echo *** Bug #26057 ***
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings

SET NAMES utf8;
CREATE TABLE t1 (a char(15) character set utf8);

INSERT INTO t1 VALUES (0xC3A2);
INSERT INTO t1 VALUES (0xC3A2C3A2C3A2C3A2C3A2);
INSERT INTO t1 VALUES (0xC3A2C3A2C3A2C3A2C3A2C3A2);
INSERT INTO t1 VALUES (0x616161C3A2C3A2);
INSERT INTO t1 VALUES (0xC3A2C3A2616161);
INSERT INTO t1 VALUES (0xC3A2414141C3A2);

SELECT hex(a) FROM t1 WHERE a = 'a';
SELECT hex(a) FROM t1 WHERE a < 'a';
SELECT hex(a) FROM t1 WHERE a > 'a';
SELECT hex(a) FROM t1 WHERE a = 'aaaaa';
SELECT hex(a) FROM t1 WHERE a = 0xC3A24161C3A2C3A2;
SELECT hex(a) FROM t1 WHERE a > 'aaaaa';
SELECT hex(a) FROM t1 WHERE a = 'aAaAaA';
SELECT hex(a) FROM t1 WHERE a = 0xC3A2C3A2C3A2C3A2C3A2;

CREATE INDEX i1 on t1 (a(5));

SELECT hex(a) FROM t1 WHERE a = 'a';
SELECT hex(a) FROM t1 WHERE a < 'a';
SELECT hex(a) FROM t1 WHERE a > 'a';
SELECT hex(a) FROM t1 WHERE a = 'aaaaa';
SELECT hex(a) FROM t1 WHERE a = 0xC3A24161C3A2C3A2;
SELECT hex(a) FROM t1 WHERE a > 'aaaaa';
SELECT hex(a) FROM t1 WHERE a = 'aAaAaA';
SELECT hex(a) FROM t1 WHERE a = 0xC3A2C3A2C3A2C3A2C3A2;

# Final cleanup.
DROP TABLE t1;
