Reference Codes and Human Labels in Tables

A reference record can carry a stable code used by software and one or more labels used for display.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace a wording update
  2. Check exported meanings
  3. Rename a label while preserving relationships
  4. Decide whether old reports need their historical wording

Trace a wording update

A status code open can stay the same after its label changes to Available. Queries filtering by code keep the same semantics. Stable codes and messages apply a similar split at an interface.

Check exported meanings

A public export can include both fields or document which one it provides. Use a record contract so callers know which value may change with language.[1][2]

Rename a label while preserving relationships

A status table can store code pending and a label displayed to readers. Changing the label to “Awaiting review” can leave all dependent rows referencing the same code. Distinct localized labels can also refer to one semantic value. See stable collection identifiers.

Stable reference: pending
Earlier label: Pending
Revised label: Awaiting review
Relationship rows continue storing pending

Decide whether old reports need their historical wording

A past snapshot may preserve the label at publication time. A current report can join the latest label instead. Test lookup after a label change and reject unexpected codes.

References

  1. PostgreSQL Global Development Group, Data Definition ↩
  2. PostgreSQL Global Development Group, SQL Language Tutorial ↩