{"record":{"id":"5507d55f975998f3","repo":"vitessio/vitess","slug":"strict-index-ordering-is-unsupported","errorCode":null,"errorMessage":"strict index ordering is unsupported","messagePattern":"strict index ordering is unsupported","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/schemadiff/errors.go","lineNumber":30,"sourceCode":"WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\npackage schemadiff\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"strings\"\n\n\t\"vitess.io/vitess/go/sqlescape\"\n\t\"vitess.io/vitess/go/vt/sqlparser\"\n)\n\nvar (\n\tErrEntityTypeMismatch             = errors.New(\"mismatched entity type\")\n\tErrStrictIndexOrderingUnsupported = errors.New(\"strict index ordering is unsupported\")\n\tErrUnexpectedDiffAction           = errors.New(\"unexpected diff action\")\n\tErrUnexpectedTableSpec            = errors.New(\"unexpected table spec\")\n\tErrExpectedCreateTable            = errors.New(\"expected a CREATE TABLE statement\")\n\tErrExpectedCreateView             = errors.New(\"expected a CREATE VIEW statement\")\n)\n\ntype ImpossibleApplyDiffOrderError struct {\n\tUnorderedDiffs   []EntityDiff\n\tConflictingDiffs []EntityDiff\n}\n\nfunc (e *ImpossibleApplyDiffOrderError) Error() string {\n\tvar b strings.Builder\n\tconflictingStatements := e.ConflictingStatements()\n\tfmt.Fprintf(&b, \"no valid applicable order for diffs. %d diffs found conflicting:\", len(conflictingStatements))\n\tfor _, s := range conflictingStatements {\n\t\tb.WriteString(\"\\n\")\n\t\tb.WriteString(s)","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/schemadiff/errors.go#L12-L48","documentation":"ErrStrictIndexOrderingUnsupported is returned when the requested diff operation requires strict preservation of index ordering, which the schemadiff engine does not support. Index comparison in Vitess is order-insensitive, so a diff that depends on exact index ordinality cannot be honored.","triggerScenarios":"Requesting a diff mode that demands strict index ordering between two CREATE TABLE entities whose indexes have the same content but different declaration order.","commonSituations":"Comparing schemas where ALTERs over time reordered index definitions; teams expecting byte-exact DDL output for equal-but-reordered indexes.","solutions":["Compare indexes without strict ordering (use the default diff behavior)","Normalize index order in both schemas before diffing","Apply the generated diff instead of expecting identical DDL text"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if !indexOrdersMatch(a, b) { return fmt.Errorf(\"strict index ordering required but differs: %w\", schemadiff.ErrStrictIndexOrderingUnsupported) }","typeGuard":null,"tryCatchPattern":"if err != nil {\n\tif errors.Is(err, schemadiff.ErrStrictIndexOrderingUnsupported) {\n\t\t// fall back to non-strict diff\n\t}\n}","preventionTips":["Normalize index declaration order in schema files","Do not rely on index ordinality for equality","Rely on generated diffs rather than byte-identical DDL"],"tags":["schemadiff","index","ordering"],"backgroundTag":"unsupported-operation","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}