## Code Analysis ### Foreign-key drop construction omits the resolved schema `server/analyzer/resolve_drop_constraint.go:42-58` ```go resolvedTable := *rt resolvedTable.Table = sql.GetUnderlyingTable(rt.Table) rt = &resolvedTable table := rt.Table if fkt, ok := table.(sql.ForeignKeyTable); ok { foreignKeys, err := fkt.GetDeclaredForeignKeys(ctx) if err != nil { return nil, transform.SameTree, err } for _, fk := range foreignKeys { if strings.EqualFold(fk.Name, dropConstraint.Name) { newNode, err := plan.NewAlterDropForeignKey(rt.Database().Name(), rt.Name(), fk.Name). WithDatabaseProvider(a.Catalog.DbProvider) return newNode, transform.NewTree, err } } } ``` The resolver first retains the resolved table, including its schema, but the foreign-key plan is constructed from the database name and unqualified table name only. The neighboring index path preserves the resolved schema with `WithTargetSchema(rt.Schema(ctx))` at lines 93-98; the foreign-key path has no corresponding schema propagation. ### Observed execution The test created both schema-qualified tables and their identically named foreign keys before attempting the drop: ```text SET CREATE SCHEMA CREATE SCHEMA CREATE TABLE CREATE TABLE CREATE TABLE CREATE TABLE CREATE INDEX INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 ``` ```text $ PGPASSWORD=[REDACTED] psql -h 127.0.0.1 -U postgres -d batch7_rev3 -v ON_ERROR_STOP=1 -c "ALTER TABLE ONLY billing.child DROP CONSTRAINT child_parent_id_fkey;" ERROR: table not found: child $ PGPASSWORD=[REDACTED] psql -h 127.0.0.1 -U postgres -d batch7_rev3 -v ON_ERROR_STOP=1 -c "ALTER TABLE billing.child DROP CONSTRAINT child_parent_id_fkey;" ERROR: table not found: child ``` The metadata readback after both attempts still contained both foreign keys: ```text nspname | relname | conname ---------+---------+---------------------- archive | child | child_parent_id_fkey billing | child | child_parent_id_fkey (2 rows) ``` ### Result The source path and captured execution support the reported failure: both schema-qualified foreign-key drop forms resolve to an unqualified `child` during execution, fail with `table not found: child`, and leave the `billing` and `archive` constraints unchanged. ### Test context The SQL scenario ran against a fresh local database without code bypasses or service mocks. Because the drop failed before the expected state transition, the later invalid-row and post-drop assertions could not proceed.