I have a really weird problem with a small database.
the table has about 400 entries and the key are two columns which contains two md5 hashes.
my table looks like this:
create table if not exists documents (id NOT NULL, pid NOT NULL, path NOT NULL, title, version, author, department, retention DEFAULT 3, date,comment TEXT,PRIMARY KEY(id, pid));
now i have for example this line of data inside the database:
sqlite> select oid,* from documents where oid = 11;
rowid|id|pid|path|title|version|author|department|retention|date|comment|publisher|record|recordretention|indoklenk
11|7408cf58dbf8985d8532b719edcd08b8|98b482dc01793d0dafa02a644fc425bd|Path\To\A\File|Checkliste.doc||||3|2012-01-23||Foobar||3|1
and now i want to change something, by giving him the OID as where:
sqlite> update documents set indoklenk = 0 where oid = 11;
Error: columns id, pid are not unique
Why i get this Error? I never change any key? Also I dont have any collisions… There are some entries which have the same id but pid is always different.
Is is it a that bad idea to change something over the oid? I never heared something bad about it…
edit: even if i change it by
update documents set indoklenk = 0 where id = '7408cf58dbf8985d8532b719edcd08b8' and pid = '98b482dc01793d0dafa02a644fc425bd';
it doesnt work! i get the same error… whats going on there? Why i cant change the data?
After a lot of research in the code i found out that the error is not from the table i update, but from a second table a log message is written. In this table the primary keys wasnt set right so if i update in the documents table, it could be that a double message occure…
check your trigger first 😉