Commit b9c6edf
Document why append may pair RETURNING rows with its input positionally (#120)
append walks the result set in lockstep with the list it was given, while
importEvents in the same class keys on the id it supplied and says why. Only one
of the two was explained, so the other read as an oversight.
It is not one: the NOT EXISTS is uncorrelated, so PostgreSQL evaluates it once as
an InitPlan and applies it as a One-Time Filter over the VALUES list, and every
node in that plan preserves order. Verified on PG16/17/18. Correlating that
predicate would let the planner turn it into an anti-join, which reorders --
measured at 1999 of 2000 rows mispaired, with positions still ascending, so a
defensive monotonicity check would not catch it either.
Javadoc only, no behaviour change.
Claude-Session: https://claude.ai/code/session_01JBdkFdTW5xgSmwMkSeiG9H
Co-authored-by: Claude <noreply@anthropic.com>1 parent 3946f82 commit b9c6edf
1 file changed
Lines changed: 20 additions & 0 deletions
File tree
- sliceworkz-eventstore-infra-postgres/src/main/java/org/sliceworkz/eventstore/infra/postgres
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1329 | 1329 | | |
1330 | 1330 | | |
1331 | 1331 | | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
1332 | 1352 | | |
1333 | 1353 | | |
1334 | 1354 | | |
| |||
0 commit comments