Repository navigation
fix(plan): preserve enum and set values on delete - #29198
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
d70a42d to
adf6d88
Compare
|
Recommendation: REQUEST_CHANGES External force review under mo-self-review of head One blocker — P2: the physical old-row boundary is fixed only in the modern DELETE planner. The new call at bind_delete.go:298 is bypassed by multi-target DELETE, FK fallback, and non-RETURNING irregular-index fallback. buildDelete binds and materializes the display projection without normalization. makePreUpdateDeletePlan subsequently assigns the declared ENUM/SET type to a column reference, but that does not convert the vector: ColumnExpressionExecutor.Eval forwards it. Thus legacy index maintenance still receives VARCHAR values where it requires stored ordinals/bitmaps. Serialization dispatches on the actual vector type, so display-text keys do not match the inserted physical keys; typed ENUM consumers can also encounter the mismatched vector. Exact-head diagnostic: using the existing planner fixture with Normalize the legacy DELETE source before its first materialization too, preserving raw storage arguments and ordered projections, and add a public fallback-path regression that verifies index cleanup/key reuse. Coverage and validation:
|
|
Implemented the P2 on
Validation: full |
|
Force-again review (gpt-6-astra medium, exact head 4b8e5d9).\n\nRecommendation: REQUEST_CHANGES.\n\nThe previous legacy-path production blocker is closed: buildDelete now normalizes before appendStep, optimization, and SINK materialization, so multi-target, FK, and non-RETURNING irregular-index fallback paths reach the physical ENUM/SET boundary. Consumer tracing found no additional production-code blocker; ordinal/bitmap preservation, zero/empty labels, NULL handling, unary/ORDER BY/LIMIT, joined deduplication, RETURNING, PK/regular/unique/composite index consumers are aligned.\n\nOne validation blocker remains: the new public multi-target cleanup/key-reuse BVT has not successfully run against this exact head. Historical 95/95 evidence predates this fix and does not prove the legacy path. Please provide a successful normal-comparison run of the updated public case, including teardown and same-instance repetition, or qualifying exact-head CI evidence. Pending CI is not treated as correctness proof.\n\nAdditional non-blocking coverage gaps to consider: actual NULL-row deletion, ENUM zero/empty-label and SET-zero execution, special-type FK/irregular fallback and joined RETURNING, and dedicated composite primary/unique cleanup cases.\n\nExact-head pkg/sql/plan CGo tests passed; diff whitespace is clean. This is COMMENT-only because the PR is self-authored. |
Summary
Fixes #29188.
DELETE index maintenance consumed the display VARCHAR projection of ENUM and SET columns, while INSERT stores ENUM ordinals and SET bitmaps. This caused missed deletes, ENUM type errors, and unique-key cleanup failures.
Validation
mo-cgo-test ... ./pkg/sql/plan: pass.go list,go vet,git diff --check, and incrementalgolangci-lint: pass, 0 issues.information_schema.