Reading Your Own Edits Before Publication

Within a transaction, reads can see that transaction's own changes under ordinary database rules while other transactions follow their visibility contract.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace a draft edit
  2. Choose where to verify
  3. Distinguish an editor's transaction view from public readers
  4. Test editor and visitor behavior independently

Trace a draft edit

An editor can read an updated title inside the transaction making the edit. An independent viewer may still see the committed earlier title. Reading committed state explains the latter observation.

Choose where to verify

Checking from inside the editor's transaction proves one thing. Fetch from a fresh view after commit when checking publication. Preview and publication describe the application states.[1]

Distinguish an editor's transaction view from public readers

A writer updating title A to title B may read B inside the same transaction before it commits. Another connection ordinarily cannot rely on seeing B during that period under read-committed semantics. Public publication can also depend on a workflow state beyond commit. See preview versus publication.

Writer changes draft title → sees draft value
External reader before commit → earlier committed view
Publication rules choose which committed revision is public

Test editor and visitor behavior independently

Verify permission and selected revision with separate clients. Test rollback and successful controlled publication. Ensure public links keep the intended stable identity.

References

  1. PostgreSQL Global Development Group, Concurrency Control ↩