Repository navigation
Conversation
…mn list The online attach now carries the parent's ON DELETE SET NULL/SET DEFAULT column list onto the table by column name, and its pre-attach check reads the list in the table's own column numbers. This retires the unreleased attach-partition-foreign-key-unsupported code, which had no other source.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
🤖 Review 1/2 (correctness) of 16f4a7e: 0 blocking, 3 non-blocking. Inspected the whole change at The change does what the body says and I found nothing that blocks it.
CI (two red checks, one cause). Invariants ( Non-blocking
Test case: a list column outside the key must not panicfunc TestTableDeleteSetColumnsOutsideTheKeyDoesNotPanic(t *testing.T) {
p := catalogFK{key: []int16{3, 4}, deleteSetColumns: []int16{9}}
assert.NotPanics(t, func() { tableDeleteSetColumns(p, []int16{2, 1}) })
}
Test case: two parent foreign keys that differ only in their list are one definitionfunc TestRefuseParentForeignKeysTwoThatDifferOnlyInTheirList(t *testing.T) {
base := catalogFK{refOID: 50, key: []int16{3, 4}, refKey: []int16{1, 2}, match: "s", onUpdate: "a", onDelete: "n", validated: true}
a, b := base, base
a.name, a.deleteSetColumns = "cards_account_fk", []int16{3}
b.name, b.deleteSetColumns = "cards_region_fk", []int16{4}
err := refuseParentForeignKeys([]parentForeignKey{
{spec: partitionedFKSpec{name: a.name}, catalog: a},
{spec: partitionedFKSpec{name: b.name}, catalog: b}})
require.ErrorIs(t, err, ErrPartitionedForeignKeyConflict)
assert.Contains(t, err.Error(), "cards_account_fk")
assert.Contains(t, err.Error(), "cards_region_fk")
}Passes on Verified
This review was generated by Claude Code (claude-sonnet-5-5). |
|
🤖 Review 2/2 (OSS adoption and integration) of 16f4a7e: 0 blocking, 2 non-blocking. Read the change from two seats: an importer that drives the online attach and routes on its outcome codes (SchemaBot is the obvious one), and an operator who meets only the error text and the guide. The addition fits the package: no new exported name, one fewer exported constant, and the same typed refusals ( Non-blocking
What reads well for adopters
This review was generated by Claude Code (claude-sonnet-5-5). |
aparajon
left a comment
There was a problem hiding this comment.
🤖 Stamping with comments: 0 blocking, 5 non-blocking (see the review comment(s) above).
This stamp was left by Claude Code (claude-sonnet-5-5).
Lets the online attach give a new partition a parent foreign key whose
ON DELETE SET NULL (cols)orSET DEFAULT (cols)names a column list, which it refused until now.Why
When pg-sprite attaches a table as a new partition online, it first gives the table every foreign key the parent has, checked while writes continue, so the attach itself scans nothing. From PostgreSQL 15 a foreign key can say that deleting a referenced row clears only some of its columns, for example
ON DELETE SET NULL (account_id)on a key over(account_id, region). The attach refused any parent with such a foreign key, because the step that adds a partition's foreign key could not write the column list. That step learned to write it for the partitioned foreign key build, so the attach can now use it too.What
ATTACH(pairAttachForeignKeys) now compares the list too, mapped into the table's column numbers by position in the foreign key. Before, it built the expected definition without a list, so it would have rejected the correct foreign key.attach-partition-foreign-key-unsupported, which nothing else produced and no release has shipped. Its rows indocs/execution-model.mdanddocs/schemabot-integration.mdare removed.Before / after
Example:
cardshasFOREIGN KEY (account_id, region) REFERENCES accounts (id, region) ON DELETE SET NULL (account_id), andcards_2027declaresaccount_idas its first column, while the parent has it third.