Skip to main content

can_fallback_array_to_varchar

Function can_fallback_array_to_varchar 

Source
async fn can_fallback_array_to_varchar(
    connector_props: &ConnectorProperties,
    array_type_name: &str,
) -> AccessResult<bool>
Expand description

Decide whether an unknown array column type (one not resolved by type_name_to_pg_type) can be represented as varchar[] in RW. This is the single question this function answers; the criteria behind it may grow over time.

Right now the answer is “yes iff the array’s element type is a user-defined enum”. Debezium does not expose element enum metadata on the array column (the enumValues field is only set for scalar enum columns), so we ask the upstream catalog directly: follow the array type’s typelem to its element type and check typtype = 'e'. Enum values are plain text, hence varchar[].

TODO(composite): arrays of composite types (typtype = 'c') should likewise map to varchar[]. That is deferred to a follow-up PR — the snapshot/streaming side for composite arrays is handled in #25818, and this predicate should be extended to typtype IN ('e', 'c') once that lands.