[auto-bump] [no-release-notes] dependency by reltuk#2872
Conversation
|
|
SummaryThis run covered core database behavior across normal operations and resilience paths, including schema updates, startup input handling, and restart/recovery behavior under misconfiguration. Most exercised areas behaved correctly, but there is a functional regression in schema-change behavior that affects migration-like workflows. Merge with caution — the results indicate a medium-severity bug introduced by this PR in a data-definition path, while other key behaviors remained stable. Because it can break real schema evolution flows, this is meaningful release risk even though the rest of the covered surface looks healthy. Tests run by ItoTip Reply with @itoqa to send us feedback on this test run. |
| github.com/cockroachdb/apd/v3 v3.2.3 | ||
| github.com/cockroachdb/errors v1.7.5 | ||
| github.com/dolthub/dolt/go v0.40.5-0.20260624213831-feba4a825720 | ||
| github.com/dolthub/dolt/go v0.40.5-0.20260625164551-d286e8926c62 |
There was a problem hiding this comment.
Rename fails on foreign key tables
What failed: Renaming a table with an existing FK fails with "foreign key ... was not found" even though the FK is present immediately before the rename.
Impact · Steps · Stub / mock · Analysis · Why this is likely a bug
- Severity: Medium
- Impact: Users cannot rename tables that have foreign key constraints, so schema migrations that depend on table renames can fail and block releases.
- Steps to Reproduce:
- Create parent_t and child_t with a foreign key from child_t.parent_id to parent_t.id.
- Confirm the FK exists in pg_constraint, then run ALTER TABLE child_t RENAME TO child_t_renamed.
- Observe errno 1105 foreign-key-not-found; repeat with a table without FKs and observe rename succeeds.
- Stub / mock content: Authentication was intentionally bypassed in the local QA environment to allow direct test connections, but no stubs or mocked database responses were used for the rename behavior itself.
- Code Analysis: The runner reproduced this deterministically in a single-client session and captured code-level evidence that the updated dependency path mutates FK table naming before lookup, producing a name mismatch and ErrForeignKeyNotFound. This PR's changed go.mod dependency lines are the direct changed-code causal path: they move dolt/go and go-mysql-server to versions where the rename/FK interaction fails for FK-bearing tables. In this repo, RootValue.RenameTable also updates table/sequence metadata but does not update foreign-key collection entries, which is consistent with the observed stale-name lookup behavior. The smallest practical fix is to make rename and FK metadata updates consistent in the renamed dependency path (or pin/revert to a known-good dependency version while applying that targeted correction).
- Why this is likely a bug: This is a production-code defect, not test setup noise: it reproduces without concurrency, fails only when an FK exists, and succeeds on a no-FK control case. The observed behavior contradicts expected DDL semantics because a valid FK present in catalog metadata should not block a rename as "not found".
Relevant code
go.mod:9-12
github.com/dolthub/dolt/go v0.40.5-0.20260625164551-d286e8926c62
github.com/dolthub/go-mysql-server v0.20.1-0.20260624214512-1199bbe99f4ecore/rootvalue.go:800-817
newStorage, err := root.st.EditTablesMap(ctx, root.vrw, root.ns, []storage.TableEdit{{OldName: oldName, Name: newName}})
if err != nil {
return nil, err
}
newRoot := root.withStorage(newStorage)
collection, err := sequences.LoadSequences(ctx, newRoot)
if err != nil {
return nil, err
}
seqs, err := collection.GetSequencesWithTable(ctx, oldName)
if err != nil {
return nil, err
}
for _, seq := range seqs {
seq.OwnerTable = id.NewTable(seq.OwnerTable.SchemaName(), newName.Name)
}
return collection.UpdateRoot(ctx, newRoot)Evidence Package
Copy prompt for an agent
Ito QA identified the following failure during automated PR testing. Please investigate and propose a fix.
**Medium severity — Rename fails on foreign key tables**
**What failed:** Renaming a table with an existing FK fails with "foreign key ... was not found" even though the FK is present immediately before the rename.
- **Impact:** Users cannot rename tables that have foreign key constraints, so schema migrations that depend on table renames can fail and block releases.
- **Steps to reproduce:**
1. Create parent_t and child_t with a foreign key from child_t.parent_id to parent_t.id.
2. Confirm the FK exists in pg_constraint, then run ALTER TABLE child_t RENAME TO child_t_renamed.
3. Observe errno 1105 foreign-key-not-found; repeat with a table without FKs and observe rename succeeds.
- **Stub / mock content:** Authentication was intentionally bypassed in the local QA environment to allow direct test connections, but no stubs or mocked database responses were used for the rename behavior itself.
- **Code analysis:** The runner reproduced this deterministically in a single-client session and captured code-level evidence that the updated dependency path mutates FK table naming before lookup, producing a name mismatch and ErrForeignKeyNotFound. This PR's changed go.mod dependency lines are the direct changed-code causal path: they move dolt/go and go-mysql-server to versions where the rename/FK interaction fails for FK-bearing tables. In this repo, RootValue.RenameTable also updates table/sequence metadata but does not update foreign-key collection entries, which is consistent with the observed stale-name lookup behavior. The smallest practical fix is to make rename and FK metadata updates consistent in the renamed dependency path (or pin/revert to a known-good dependency version while applying that targeted correction).
- **Why this is likely a bug:** This is a production-code defect, not test setup noise: it reproduces without concurrency, fails only when an FK exists, and succeeds on a no-FK control case. The observed behavior contradicts expected DDL semantics because a valid FK present in catalog metadata should not block a rename as "not found".
**Relevant code:**
`go.mod:9-12`
~~~go
github.com/dolthub/dolt/go v0.40.5-0.20260625164551-d286e8926c62
github.com/dolthub/go-mysql-server v0.20.1-0.20260624214512-1199bbe99f4e
~~~
`core/rootvalue.go:800-817`
~~~go
newStorage, err := root.st.EditTablesMap(ctx, root.vrw, root.ns, []storage.TableEdit{{OldName: oldName, Name: newName}})
if err != nil {
return nil, err
}
newRoot := root.withStorage(newStorage)
collection, err := sequences.LoadSequences(ctx, newRoot)
if err != nil {
return nil, err
}
seqs, err := collection.GetSequencesWithTable(ctx, oldName)
if err != nil {
return nil, err
}
for _, seq := range seqs {
seq.OwnerTable = id.NewTable(seq.OwnerTable.SchemaName(), newName.Name)
}
return collection.UpdateRoot(ctx, newRoot)
~~~
Footnotes
|
|
This PR has been superseded by #2873 |

☕ An Automated Dependency Version Bump PR 👑
Initial Changes
The changes contained in this PR were produced by `go get`ing the dependency.
```bash
go get github.com/dolthub/[dependency]/go@[commit]
```