Repository navigation
v2.0.5 – Reflective Decoder Error Diagnostics
Release notes:
This update introduces advanced, human-readable diagnostics for reflection-based PostgreSQL decoding and optional parameter encoding support for array types.
Changes & Fixes
- Added explicit column and field context to all reflection decode errors.
map_row_reflect_positionalandmap_row_reflect_namednow include:- field name, field C++ type,
- column name, PostgreSQL column type (via OID mapping when available),
- actual value preview (
got="...").
- Added new overload
map_row_reflect_positional_ex— supports enriched metadata (column names and OIDs). - Refactored internal error formatting (
format_mismatch_named/format_mismatch_positional) to produce natural-language, diagnostic messages. - Introduced optional compile-time switches:
UPQ_RESULT_HAS_COLUMN_OIDS,UPQ_ROW_HAS_COLUMN_OIDS— enable OID→typename resolution.UPQ_HAVE_OID_TO_TYPENAME— integrate customoid_to_typename()mapper.
- Preserved backward compatibility with all existing reflection APIs — no function signatures changed.
- Added optional
UPQ_ENABLE_PARAM_ENCODERto safely encodestd::vector,std::optional, and aggregates into PostgreSQL text parameters ({1,2,3},{"a","b"}).
Behavioral Improvements
-
Decode errors now produce context-rich messages, e.g.:
row=0: decode failed: field='amount' (type=double) ← column='amount_str' (type=text): expected=double, got="not_a_number" -
Positional reflection includes column name and type when available, rather than only
field#N. -
Stronger column-count validation: clearly reports
not enough columns: expected=5, got=3. -
Array decoding logic unchanged but now coexists with safe text encoder for insert operations.
-
Fail-fast behavior — decoding stops immediately on first invalid column/field mapping.
Impact
- Greatly improves observability during reflective result decoding.
- Eliminates silent mismatches between C++ struct fields and SQL schema.
- Optional array/text encoder simplifies reflective INSERT/UPDATE operations.
- No existing user code breaks — new behavior is purely additive and opt-in.