问题描述
这是我拥有的两个表的匿名表示:
CREATE VIEW v_numbers AS
SELECT n.*,CASE WHEN a <> 0
THEN (b / c) - avg(b / c) FILTER(WHERE a <> 0) OVER (PARTITION BY user)
END AS e
FROM numbers n
当我在表格中插入代码时:
create table if not exists master_node (
book_name text primary key on conflict ignore not null
);
create table if not exists category_table (
book_name text not null,category text not null,foreign key(book_name) references master_node(book_name) on delete cascade,unique(book_name,category) on conflict ignore
);
和
insert into master_node
(book_name)
values
('Harry Potter'),('Foundation'),('The Catcher in the Rye')
我收到一个 insert or ignore into category_table
(book_name,category)
values
(Harry Potter','Fiction'),('Harry Potter','Fantasy'),('Foundation','Science Fiction'),('The Catcher in the Rye','Coming-of-age'),('Moby Dick','Adventure')
错误并且事务被回滚。
我希望通过使用 [SQLITE_CONSTRAINT] Abort due to constraint violation (FOREIGN KEY constraint failed)
我能够简单地跳过具有外键约束违规的行。我一直无法找到获得这种行为的方法。 sqlite 是否提供了这样做的方法?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)