SYSE.34:5.1 - Define a reversible address correspondence
In a constructed ParcelWorks example, one non-partitioned PostgreSQL 18 table has an immutable row ID and a non-null Unicode text value D, stored as delivery_address. Old applications read and replace that whole value. The new form edits the first display line L separately from the remaining display text T. It does not infer postal structure.
Split D at its first line-feed character, LF. If no LF exists, set L = D and T = null. Otherwise L is the text before that LF and T is all text after it, including any further line feeds. Reconstruct D as L when T is null, or L + LF + T otherwise. L must contain no LF. Preserve every character; do not normalize whitespace.
| Old D | New L | New T | Reconstructed meaning |
|---|---|---|---|
| 12 Oak St | 12 Oak St | null | No line separator was present. |
| 12 Oak St followed by LF | 12 Oak St | empty text | The trailing separator is preserved. |
| 12 Oak St, LF, North, LF, Depot | 12 Oak St | North, LF, Depot | Remaining lines stay in the tail. |
| Empty text | empty text | null | Empty but non-null old text remains representable. |
This correspondence makes old and new text mutually recoverable within the stated domain. Postal parsing, normalization or an additional field that cannot be joined back is outside it and reopens the recovery decision.