fix: schema-qualify DROP INDEX for non-default schemas - #2289
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
…chema-qualify-drop-index
|
Thanks for this fix — the root cause analysis is spot-on and the implementation is clean. The issue was that Tests look thorough: schema-qualified drops for PostgreSQL/Oracle, unqualified for SQLite, table-scoped for MySQL/MSSQL, partial unique constraint drop, and the no-schema backward-compatible path. CI is green and CodSpeed shows no impact. Happy to approve. |
Description
Schema-qualify
DROP INDEXon PostgreSQL and Oracle soRemoveIndexand partialRemoveConstraintcan drop indexes that live outside the connectionsearch_path.remove_index()already passed a schema-qualified{table}intoDROP INDEX "{name}", but the template has no{table}placeholder, sostr.format()discarded it. Create still used{table_name}via_qualify_table_name(), which is why the index existed and the drop then failed withindex "..." does not exist.Name-only dialects now qualify the index identifier itself (
DROP INDEX "schema"."name"). MySQL and MSSQL keep their table-scopedDROP INDEX ... ON {table}form.Motivation and Context
Fixes #2288.
How Has This Been Tested?
make checkmake test(sqlite in-memory): 1959 passed, 148 skipped, 2 xfailedChecklist:
Made with Cursor