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 or composite”. Debezium does not expose element enum/composite metadata on the array column (the enumValues field is only set for scalar enum columns, and jdbcType == STRUCT is only set for scalar composite columns), so we ask the upstream catalog directly: follow the array type’s typelem to its element type and check typtype IN ('e', 'c'). Enum values are plain text, and composite values are converted to text by our CustomConverter, hence varchar[].