Skip to content

Commit 82de2b3

Browse files
authored
Merge pull request #499 from shangyian/type-compatible-bug
Fix type compatibility check for IF statements
2 parents 09a7e98 + 49617fd commit 82de2b3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

dj/sql/functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ def infer_type( # noqa: F811 # pylint: disable=function-redefined
495495
then: ct.ColumnType,
496496
else_: ct.ColumnType,
497497
) -> ct.ColumnType:
498-
if then.type != else_.type:
498+
if not then.type.is_compatible(else_.type):
499499
raise DJInvalidInputException(
500500
message="The then result and else result must match in type! "
501501
f"Got {then.type} and {else_.type}",

0 commit comments

Comments
 (0)