Which database data-type boundaries commonly cause defects?
Answer
High-risk boundaries include integer overflow, decimal precision and rounding, floating-point comparison, text length and encoding, case and collation, dates, time zones, daylight-saving transitions, binary data and NULL. Generate values immediately inside and outside each declared limit and trace conversions across API, application, database, export and report layers. Verify rejection or rounding rules, storage fidelity, sorting and comparison behaviour, and that migrations do not silently narrow existing values.
Strong answer includes
- covers numeric, text and temporal boundaries
- traces conversions across system layers
- checks storage fidelity and migration narrowing
Practical example
TIMESTAMPTZ and the demonstrated type enforcement are PostgreSQL-oriented and should not be simulated with SQLite's different typing model.
CREATE TABLE payments (
amount NUMERIC(10,2) NOT NULL,
reference VARCHAR(8) NOT NULL,
paid_at TIMESTAMPTZ NOT NULL
);
-- Boundary probes
INSERT INTO payments VALUES (99999999.99, 'ABCDEFGH', '2026-03-29T00:30:00+00');
INSERT INTO payments VALUES (100000000.00, 'ABCDEFGHI', '2026-03-29T00:30:00+00');The first row is at declared numeric/text limits; the second exceeds both. Boundary tests should also trace rounding, encoding and time-zone conversions through API, application, database and export layers.
Expected result: The in-range insert succeeds and the out-of-range values are rejected rather than silently truncated.