Description
When using a table with a mix of UUIDs and alphanumeric strings as primary keys, reladiff incorrectly assumes all primary keys are UUIDs. This causes the following error when sampling data:
packages/reladiff/diff_tables.py", line 322, in _parse_key_range_result
raise type(e)(f"Cannot apply {key_types} to '{min_key_values}', '{max_key_values}'.") from e
ValueError: Cannot apply [String_UUID()] to '('0001aa71db2877006cc4fd051d96195f',)', '('system52923',)'.
The issue appears when the primary keys contain values that follow UUID format (like 0001aa71db2877006cc4fd051d96195f) alongside other alphanumeric values (like system52923) that cannot be parsed as UUIDs.
Environment
- reladiff version: 0.6.0
- OS: macOS
- Database: PostgreSQL 15
Expected behavior
reladiff should handle mixed primary key formats correctly, potentially by using a more flexible type like String_Alphanum instead of assuming all keys are UUIDs.
Proposed solution
Is there a way to explicitly specify the primary key data type to enforce String_Alphanum or a similar more permissive type? Alternatively, could reladiff be enhanced to automatically fallback to a more general string type when UUID parsing fails?
Additional information
The issue occurs during data sampling when reladiff attempts to determine the primary key range. It appears that the type detection logic assumes homogeneous primary key types and fails when encountering mixed formats.
Description
When using a table with a mix of UUIDs and alphanumeric strings as primary keys,
reladiffincorrectly assumes all primary keys are UUIDs. This causes the following error when sampling data:The issue appears when the primary keys contain values that follow UUID format (like
0001aa71db2877006cc4fd051d96195f) alongside other alphanumeric values (likesystem52923) that cannot be parsed as UUIDs.Environment
Expected behavior
reladiff should handle mixed primary key formats correctly, potentially by using a more flexible type like
String_Alphanuminstead of assuming all keys are UUIDs.Proposed solution
Is there a way to explicitly specify the primary key data type to enforce
String_Alphanumor a similar more permissive type? Alternatively, could reladiff be enhanced to automatically fallback to a more general string type when UUID parsing fails?Additional information
The issue occurs during data sampling when reladiff attempts to determine the primary key range. It appears that the type detection logic assumes homogeneous primary key types and fails when encountering mixed formats.