Context
Follow-up from the autonumber generation fix in objectql (engine applyAutonumbers). Today, empty autonumber fields are generated before required-validation as max(existing)+1, seeded per object.field and incremented in memory.
Gap
- The in-memory counter is correct for a single instance (re-seeds from max on restart; monotonic in-process), but two instances can collide.
- The seed currently loads up to 5000 rows to compute max.
Proposal
Back autonumber with a persistent, atomically-incremented sequence at the driver layer (e.g. a sys_sequence row with UPDATE ... RETURNING value+1, or native DB sequences), so values are correct across instances. Replace the row-scan seed with a max() aggregate as an interim improvement.
Notes
- Touches
packages/objectql/src/engine.ts + drivers — hot files; dedicated, reviewed change.
Context
Follow-up from the autonumber generation fix in
objectql(engineapplyAutonumbers). Today, emptyautonumberfields are generated before required-validation asmax(existing)+1, seeded perobject.fieldand incremented in memory.Gap
Proposal
Back autonumber with a persistent, atomically-incremented sequence at the driver layer (e.g. a
sys_sequencerow withUPDATE ... RETURNING value+1, or native DB sequences), so values are correct across instances. Replace the row-scan seed with amax()aggregate as an interim improvement.Notes
packages/objectql/src/engine.ts+ drivers — hot files; dedicated, reviewed change.