Skip to content

Commit

Permalink
Bug 1941655 - relax places DB constraints to what they were before bu…
Browse files Browse the repository at this point in the history
…g 1935797
  • Loading branch information
mhammond committed Jan 21, 2025
1 parent cb41b0a commit f3d54ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions components/places/sql/create_shared_triggers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ BEGIN

SELECT throw('update: item without parent')
WHERE NEW.guid <> 'root________'
AND NOT EXISTS(
SELECT 1 FROM moz_bookmarks WHERE id = NEW.parent);
AND NEW.parent IS NULL;
-- bug 1941655, this seemingly more correct check causes obscure problems.
-- AND NOT EXISTS(
-- SELECT 1 FROM moz_bookmarks WHERE id = NEW.parent);

SELECT throw(format('update: old type=%d; new=%d', OLD.type, NEW.type))
WHERE OLD.type <> NEW.type;
Expand Down
5 changes: 4 additions & 1 deletion components/places/src/db/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -560,11 +560,13 @@ mod tests {
e,
);

// Bug 1941655 - we only guard against NULL parents, not missing ones.
/*
let e = conn
.execute(
"UPDATE moz_bookmarks SET
parent = -1
WHERE guid = 'folder_guid_'",
WHERE guid = 'folder_guid_'",
[],
)
.expect_err("should fail to update folder with nonexistent parent");
Expand All @@ -573,6 +575,7 @@ mod tests {
"Expected error, got: {:?}",
e,
);
*/
}

// Invalid length guid
Expand Down

0 comments on commit f3d54ca

Please sign in to comment.