INSTALL SONAME 'ha_spider';

# MDEV-27186
CREATE TABLE t (s INT) ENGINE=SPIDER PARTITION BY HASH (s);
LOAD INDEX INTO CACHE t PARTITION (p,p1);
DROP TABLE t;

# MDEV-27237
CREATE TABLE t (c INT PRIMARY KEY) ENGINE=SPIDER PARTITION BY KEY() PARTITIONS 2;
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
HANDLER t OPEN AS h;
DROP TABLE t;

# MDEV-27334
CREATE TABLE t (c INT PRIMARY KEY) ENGINE=SPIDER PARTITION BY HASH (c) PARTITIONS 2;
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
CREATE TRIGGER t AFTER INSERT ON t FOR EACH ROW INSERT INTO t VALUES(0);
DROP TABLE t;

# MDEV-28241
CREATE TABLE t (b INT) ENGINE=InnoDB;
PREPARE s FROM 'SELECT * FROM t LIMIT 2';
DROP TABLE t;
CREATE TABLE t (a INT) ENGINE=Spider PARTITION BY LIST (a) PARTITIONS 2 (PARTITION p1 VALUES IN (0,1),PARTITION p2 VALUES IN (2,3));
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
EXECUTE s;
DROP TABLE t;

# MDEV-34101
CREATE TABLE t (c INT) ENGINE=InnoDB;
LOCK TABLES t WRITE;
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
CREATE OR REPLACE TABLE t (d INT) ENGINE=Spider PARTITION BY LIST COLUMNS (d) (PARTITION p VALUES IN (0));
drop table t;

--disable_query_log
--source ../../include/clean_up_spider.inc
