Dbo: remove() object with defined ManyToMany relations: constraint failed (bug?)
Added by Vladimir Zibarov almost 12 years ago
Maybe this is a bug, but I can't tell for sure (maybe I'm doing something wrong).
Wt::Dbo with Sqlite3 backend (Wt version wt-3.2.3-rc1)
Two objects - Tag and Post with ManyToMany relations.
Created 1 tag, 1 post, 1 relation (added tag to post's tags collection).
After that:
if I try to do post.remove() - I get:
Sqlite3: delete from "post" where "id" = ? and "version" = ?: constraint failed
if I try post.modify()tags.clear() I get:
Sqlite3: delete from "tag" join "post_tags" on "post_tags"."tag_id" = "tag"."id" where "post_tags"."post_id" = ?: near "join": syntax error
any help would be appreciated, thanks.
Replies (3)
RE: Dbo: remove() object with defined ManyToMany relations: constraint failed (bug?) - Added by Vladimir Zibarov almost 12 years ago
UPD: updated to wt-3.2.3, same errors
RE: Dbo: remove() object with defined ManyToMany relations: constraint failed (bug?) - Added by Vladimir Zibarov almost 12 years ago
For now, I have a solution: manually erase each relation and then remove object.
{
dbo::Transaction transaction(session);
while(post->tags.size()){
post.modify()tags.erase(*post>tags.begin());
}
post.remove();
}
RE: Dbo: remove() object with defined ManyToMany relations: constraint failed (bug?) - Added by Koen Deforche almost 10 years ago
Can you check with wt bit version? I believe we recently fixed this.