Ruby SQLite在insert上声明重复行,但找不到任何行

Ruby SQLite在insert上声明重复行,但找不到任何行,ruby,sqlite,duplicates,sequel,Ruby,Sqlite,Duplicates,Sequel,我在SQLite数据库中有一个表,它是用下面的代码创建的。注意复合主键: db.create_table(:person_hash) do Integer :person_id Bignum :hash // MD5 hash in hex stored as numeric: hash.to_i(16) primary_key [:person_id, :hash] end 此表已包含一些行: puts db[:person_hash].where(:person_id =>

我在SQLite数据库中有一个表,它是用下面的代码创建的。注意复合主键:

db.create_table(:person_hash) do
  Integer :person_id
  Bignum :hash // MD5 hash in hex stored as numeric: hash.to_i(16)
  primary_key [:person_id, :hash]
end
此表已包含一些行:

puts db[:person_hash].where(:person_id => 285577).all
# {:person_id=>285577, :hash=>306607097659338192312932577746542919680}
现在,当我尝试插入以下内容时:

db[:person_hash].insert({:person_id=>285577, :hash=>306607097659338206333361532286405644297})
我明白了:

SQLite3::ConstraintException: columns person_id, hash are not unique (Sequel::DatabaseError)
如果该行在表中不存在,它怎么可能是重复的?


我尝试为同一个人ID插入另一个哈希值,但没有问题。

这似乎是SQLite中的一个错误:


$sqlite3
SQLite版本3.8.9 OpenBSD
输入“.help”以获取使用提示。
连接到内存中的临时数据库。
使用“.open FILENAME”在持久数据库上重新打开。
sqlite>创建表person_hash(person_id integer,hash bigint,主键(person_id,hash));
sqlite>插入person_散列值(2855773066070976593381923129332577747442919680);
sqlite>插入person_散列值(285577306607097659338206333361532286405644297);
错误:唯一约束失败:person\u hash.person\u id,person\u hash.hash

将数据传输到一个新表中,并改为使用代理PK。我知道我可以依靠你。谢谢有趣的是,这样一个bug禁用了复合键的整个特性,至少在这里看到的情况下,PK是表中唯一的列。