--source include/have_falcon.inc
SET storage_engine = Falcon;
#
# Bug #22564: auto_increment column gets automatically incremented
#
# Multi-part key can only have autoincrement in first column
#
# Acceptable:     key (a, b, c) a = autoincrement
# Acceptable:     key (b, a, c) b = autoincrement
# Not acceptable: key (a, b, c) b = autoincrement
#

--echo *** Bug #22564 ***
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
--enable_warnings

CREATE TABLE t1 (a int auto_increment, b int, c int, key (a, b, c));

INSERT INTO t1 VALUES (null, 1, 1);
INSERT INTO t1 (b, c) VALUES (2,2), (3,3), (4,4);
SELECT * FROM t1 ORDER BY a;

CREATE TABLE t2 (a int, b int auto_increment, c int, key (b, a, c));

INSERT INTO t2 VALUES (1, null, 1);
INSERT INTO t2 (a, c) VALUES (2,2), (3,3), (4,4);
SELECT * FROM t2 ORDER BY b;

--error ER_WRONG_AUTO_KEY
CREATE TABLE t3 (a int, b int auto_increment, c int, key (a, b, c));

SHOW TABLES;

# Final cleanup.
DROP TABLE t1;
DROP TABLE t2;

