Repository navigation
Conversation
The attach index step now gives a table that is itself partitioned a valid partitioned index for each of the parent's plain indexes, by running the partitioned index build on it, so the ATTACH pairs them and builds nothing. A parent key constraint is taken only when the table already has it.
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
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 e06c45b: 0 blocking, 4 non-blocking. Inspected the whole change at What the change does: for a table to attach that is itself partitioned, a parent index that backs no constraint and that the pairing gives nothing is built as a valid partitioned index of the table under the derived name, by calling the existing partitioned index build on the table. A parent Invariants ( Consistency with #702, #710 and #712: this PR is the index half of what #702 does for foreign keys on a sub-partitioned table, and it stays out of their files. It uses Non-blocking
Test case (not run here: no local checkout): a missing key is refused before any index is builtfunc TestEnsureAttachIndexesRefusesAPartitionedTablesMissingKeyBeforeBuildingAnyIndex(t *testing.T) {
withAttachProofServer(t, func(t *testing.T, newFixture func(t *testing.T) attachProofFixture) {
f := newFixture(t)
f.exec(t, visitsByRegion) // visits_id_idx and visits_page_idx first
f.exec(t, `ALTER TABLE %[1]s.visits ADD CONSTRAINT visits_pkey PRIMARY KEY (id, day, region)`)
_, err := ensureAttachIndexes(t.Context(), f.pool, f.parentOID(t, "visits"), f.standalonePartitioned(t, "visits_2027"), attachIndexBudget, nil, 0, nil)
require.ErrorIs(t, err, errAttachIndexUnsupported)
for _, rel := range visits2027Tree {
assert.Empty(t, f.tableIndexes(t, rel), "%s has no index", rel)
}
})
}At the head the two plain parent indexes sort before the key, so
Verified
This review was generated by Claude Code (claude-sonnet-5-5). |
|
🤖 Review 2/2 (OSS adoption and integration) of e06c45b: 0 blocking, 3 non-blocking. Read the change from two seats: a host (a schema change orchestrator, or any importer of 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, 7 non-blocking (see the review comments above).
This stamp was left by Claude Code (claude-sonnet-5-5).
|
🤖 I reviewed all seven changed files at Bind the nested build to the resolved source before enabling partitioned sources in the public flow. The wrapper proves the standalone source in a catalog read, then hands off only schema and name. If a concurrent rename puts an equivalent partitioned table under that name before the nested build resolves it, the nested build accepts the replacement OID and can commit index DDL there. The final standalone proof rejects the original attach after those writes. Pass the expected standalone node into the builder and prove it under the root DDL lock before creating or using the root index. The public flow still refuses partitioned sources at this head. Attach index handoff · Nested target resolution GitHub reported 16 successful checks and two failures. I reviewed the code and the visible PR discussion. I did not run tests locally. PostgreSQL 18 other packages · all-green Builderbot’s review result was unavailable. I did not independently verify unresolved inline threads. |
JashLal
left a comment
There was a problem hiding this comment.
🤖 Approved by Codex on Jash behalf after reviewing e06c45b. See the review comment for findings and verification limits; approval does not resolve those findings. Preserve the stack merge order and resolve the source-identity gap before wiring the public flow.
Refuse a partitioned table's missing parent key before any index is built, name the key to add, and cover the kind guard, the unique and duplicate-index cases, and the tracker hand-off the reviews flagged.
|
🤖 Adversarial review response — created by Kiran's code review agent (Amp, claude-opus-5-5) — pull/713, follow-up commit All 8 findings from the three review comments are fixed in the follow-up commit. Nothing is deferred and nothing is rejected.
The "Verified" and mutation-table sections of the first comment, and the "What reads well for adopters" section of the second, need no action. Source: block/pg-sprite#713, review comments 7368504738, 7368506078 and 7383631457, and reviews 6164061019 and 6173132628, at head |
The online attach's index step now gives a table that is itself partitioned the parent's indexes, built concurrently, so the attach of such a table builds no index.
Why
When pg-sprite attaches a partition online, it first gives the new table every index of the parent, built concurrently while writes go on, because the
ATTACHwould otherwise build them while it blocks the table. For a table that is itself partitioned, theATTACHlooks for a valid partitioned index on that table to pair with each parent index. If it finds none, it builds the index on every partition of the table, all underACCESS EXCLUSIVE. Until now the index step refused a partitioned table outright. This PR gives it those indexes ahead of time, one step closer to attaching a sub-partitioned table online. The attach flow still refuses one until the foreign key step follows.What
<index>_p<table oid>. The build creates the table's indexON ONLY, builds every leaf's index concurrently, attaches each level bottom up, and returns once the table's index is valid. A rerun resumes an index a stop left invalid.ATTACHpairs a valid one and passes over an invalid one, building the index across the whole tree. The pairing already skipped invalid indexes.PRIMARY KEYorUNIQUEconstraint is taken when the table already has the matching key. Otherwise it is refused withattach-partition-index-unsupportedbefore anything is built; the key build follows in the next PR.Before / after
Take
visits, indexed onidandlower(page), andvisits_2027, partitioned by region intovisits_2027_euandvisits_2027_us, which is split again by id. The index step runs onvisits_2027before the attach. Before, it refused the table; after, it builds both indexes across the tree without blocking writes, and theATTACHtakes them.