1
我試圖使用RTREE,面對這個陌生的beheaviour:INSERT語句與一個普通表工作正常的RTREE表失敗:sqlite的RTREE:約束失敗(與常規表的工作原理)
這個例子正常工作:
DROP TABLE IF EXISTS ltssoffsets;
CREATE TABLE ltssoffsets(id TEXT NOT NULL,
offset_start INT NOT NULL,
gene_start INT NOT NULL,
chr TEXT NOT NULL, start INT, end INT,
PRIMARY KEY (id, offset_start));
INSERT INTO ltssoffsets VALUES("first", -10, 45, "chr2", 30, 40);
INSERT INTO ltssoffsets VALUES("first", -5, 45, "chr2", 30, 40);
這一次失敗:
DROP TABLE IF EXISTS ltssoffsets;
CREATE VIRTUAL TABLE ltssoffsets USING rtree(id TEXT NOT NULL,
offset_start INT NOT NULL,
gene_start INT NOT NULL,
chr TEXT NOT NULL, start INT, end INT,
PRIMARY KEY (id, offset_start));
INSERT INTO ltssoffsets VALUES("first", -10, 45, "chr2", 30, 40);
INSERT INTO ltssoffsets VALUES("first", -5, 45, "chr2", 30, 40);
-> Error: constraint failed
什麼可以錯在這裏?
沒錯。這絕對是一種非預期的用法,但錯誤是令人困惑的,因爲它不會彈出表格初始化,而是插入到表格中 –