The Route, Not the Rock: Stable Identifiers in a Country of Moving Postcodes
Photo: David Howard , CC BY-SA 2.0, via Wikimedia Commons
A UK postcode has the reassuring quality of bedrock. It appears on letters, invoices, electoral rolls, and delivery labels. It is short enough to memorise and structured enough to validate. That familiarity encourages a costly assumption: that the postcode is a stable property of a place, and therefore a sensible key for a person, premises, or order.
It is not. A postcode is an operational routing code maintained for mail delivery. It can be introduced, split, recoded, or retired as streets are built, boundaries are redrawn, and delivery rounds are reorganised. The engineering mistake is rarely using postcodes at all. The mistake is allowing an external authority's working data to leak into the core identity model of a system that must outlive several postal revisions.
An address is a relationship, not a row
Most address models fail because they treat an address as a single mutable string. In practice, an address combines several distinct concerns: a physical location, an access point, an occupier, a postal route, and a label used by people. The same building may carry multiple postal addresses. A single postcode may cover many premises. A premises may retain its identity while its postal route changes.
A robust design begins by modelling the thing that persists. That may be a premises, a property, a party, or a service point. Give that entity an internal identifier that your organisation controls, such as a UUID or ULID. External identifiers belong in a separate table with source, value, observed date, and validity period. A UPRN can be extremely useful, but it remains an external identifier with its own governance. It should be treated as a high-quality reference, not as a substitute for your own identity strategy.
Treat authority data as claims, not truth
Postal and address data arrives from authorities, suppliers, and users. Each source has a perspective. A local authority gazetteer, a Royal Mail routing dataset, and a customer's typed address may disagree. The system should record those disagreements rather than silently choosing one and overwriting the past.
Model postcode routes and address assignments as effective-dated claims. A row should answer: what was asserted, by which source, when was it observed, and for what period was it considered valid? This is not bureaucratic decoration. It is what allows an order placed last year to remain explainable after a postcode split, and what allows a support agent to understand why two systems show different labels for the same premises.
At the boundary, validate format and existence separately. A regular expression can confirm that a string resembles a UK postcode. It cannot confirm that the postcode currently routes to the stated premises. Existence checks need time awareness and a fallback path. Record the validation result and its source. Do not make a failed lookup an absolute barrier to an emergency operation; make it an explicit exception with an audit trail.
Keep snapshots where history matters
There is a useful distinction between reference and snapshot. A reference points to the current address record. A snapshot preserves the address as it was when a transaction occurred. Fulfilment, billing, and statutory records often need the snapshot; operational systems need the reference. Store both where the business event demands it, and make clear which one is authoritative for which purpose.
For example, an order should retain the delivery address as presented at checkout, alongside a link to the premises identity. If the postcode is later recoded, the historical delivery record should not be rewritten. Instead, a migration process can append a new route assignment, flag affected open records, and notify downstream systems through an event. Closed records remain stable.
Migration patterns for splits, merges, and retirement
When a postcode splits, avoid cascade updates to core tables. Append the new mapping, mark the old assignment as superseded for future use, and provide an alias so legacy lookups still resolve. When a postcode retires, keep it queryable for historical records but reject it for new transactions after a defined cut-off. When external identifiers merge or split, use an identity-resolution table rather than destructive updates.
A practical schema separates premises, addresses, external identifiers, postal routes, route assignments, and address snapshots. The exact tables matter less than the boundaries: internal identity is yours; external authority data is referenced, versioned, and never allowed to become the primary key of the business domain.
The postcode is a route, not a rock. Build as if the route will change, because it will. The systems that endure are those that can explain the change without losing the place.