Problem
dbkit supports:
Vec<String> // required TEXT[] value with non-null elements
Option<Vec<String>> // nullable TEXT[] value with non-null elements
It does not support PostgreSQL arrays containing nullable elements:
Vec<Option<String>>
Option<Vec<Option<String>>>
Using Vec<Option<String>> in a #[model] currently fails during macro expansion because dbkit::Value only supports Vec<String>. Conversely, reading a valid PostgreSQL value such as ARRAY['one', NULL, 'three'] into Vec<String> fails during decoding.
Expected behavior
- Support
Vec<Option<String>> for a present TEXT[] containing nullable elements.
- Support
Option<Vec<Option<String>>> so container and element nullability compose.
- Preserve existing
Vec<String> and Option<Vec<String>> behavior.
- Cover insertion, updates, selection, and binding where arrays are currently supported.
- Test empty arrays, mixed values/NULLs, all-NULL elements, and a NULL array.
This can start with the existing TEXT[] support; it does not need to generalize every PostgreSQL array element type at the same time.
PostgreSQL array NULL elements
Problem
dbkit supports:
It does not support PostgreSQL arrays containing nullable elements:
Using
Vec<Option<String>>in a#[model]currently fails during macro expansion becausedbkit::Valueonly supportsVec<String>. Conversely, reading a valid PostgreSQL value such asARRAY['one', NULL, 'three']intoVec<String>fails during decoding.Expected behavior
Vec<Option<String>>for a presentTEXT[]containing nullable elements.Option<Vec<Option<String>>>so container and element nullability compose.Vec<String>andOption<Vec<String>>behavior.This can start with the existing
TEXT[]support; it does not need to generalize every PostgreSQL array element type at the same time.PostgreSQL array NULL elements