Closed Bug 1935797 Opened 1 year ago Closed 1 year ago

Replace CHECK and FOREIGN KEY constraints on `moz_bookmarks` with triggers

Categories

(Application Services :: Places, task)

Tracking

(firefox135 fixed)

RESOLVED FIXED
135 Branch
Tracking Status
firefox135 --- fixed

People

(Reporter: lina, Assigned: lina)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fxsync])

Attachments

(1 file)

We've seen a consistently high number of CHECK constraint failures on moz_bookmarks (bug 1876320). Unfortunately, those errors don't tell us which condition in the constraint failed—or which value in the new row would violate the condition, or which operation was responsible—so we don't have a good way to narrow down the cause of the problem.

Instead of using CHECK constraints, we can create BEFORE INSERT and BEFORE UPDATE triggers on moz_bookmarks to enforce the invariants that we want. Unlike a CHECK constraint, a trigger gives us access to all values in the new row, and lets us fail an insert or update with a custom error message.

(While we're at it, we can replace our FOREIGN KEY constraint on moz_bookmarks.parent with the same validation trigger—foreign keys are already implemented using triggers under the hood, and we can consolidate the validation into one BEFORE INSERT / UPDATE trigger).

Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Whiteboard: [fxsync]
Flags: qe-verify+
Target Milestone: --- → 135 Branch
See Also: → 1945621
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: