Fix 4 trigger handling bugs #1626
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1625 — four related bugs found by code inspection of the trigger handling logic.
Bug 1: Double-transformation in trigger length validation
ValidateGhostTriggerLengthBelowMaxLengthcalledGetGhostTriggerNameon an already-transformed name, adding the suffix twice and falsely rejecting valid trigger names.Bug 2: Atomic cut-over silently ignores trigger creation errors
CreateTriggersOnGhosterror was logged but not returned during atomic cut-over, causing silent trigger loss.returnto match the two-step cut-over behavior.Bug 3:
validateGhostTriggersDontExistchecks wrong table scopeevent_object_table, missing conflicts on other tables in the same schema.Bug 4: SQL injection in
GetTriggers()fmt.Sprintfstring interpolation instead of parameterized query.?placeholders, matching the safe pattern ininspect.go.Test plan
go/base/context_test.go— tests now simulate the real call pattern (transform first, then validate) with boundary tests at 64/65 charslocaltests/trigger-long-name-validation— verifies 60-char trigger names are not falsely rejected (Bug 1)localtests/trigger-ghost-name-conflict— verifies ghost name conflicts on other tables are detected (Bug 3)go build ./...— cleango test ./go/base/ ./go/mysql/ ./go/sql/— all passThank you, Yakir Gibraltar