Module 3 / Lesson 3.1

Postgres and Oracle Invariants

Open the Oracle lane and keep the no-overlap invariant true without Postgres-only features.

Concept

Cross-database support is not a checkbox. Phase 3 keeps the same domain invariant while admitting that Postgres and Oracle enforce it differently.

Task

  1. Add an Oracle profile and vendor-split Flyway migrations.
  2. Document identity, pagination, type mappings, timestamp semantics, and overlap strategy in oracle-notes.md.
  3. Parameterize the invariant suite across database lanes.
  4. Use a screen-row SELECT FOR UPDATE trigger as the Oracle overlap strategy.

Run

./gradlew test --tests "*CrossDatabaseInvariantSuiteTest"

Expected Result

  • The shared suite names duplicate showtime, concurrent overlap, optimistic locking, stable pagination, lazy boundary, and DST round-trip proofs.

Common Traps

  • Pretending Oracle can use the Postgres tstzrange exclusion constraint.
  • Testing only repository happy paths and calling it database compatibility.
  • Leaving timezone behavior implicit.

Hint Ladder

Hint 1

Keep the invariant stable even when the mechanism changes.

Hint 2

Use notes for every divergence; memory is not a strategy.

Hint 3

The heavy Oracle lane belongs on main pushes and release PRs, not every docs-only edit.

Solution

See docs/oracle-notes.md and CrossDatabaseInvariantSuiteTest.java.