Project

General

Profile

« Previous | Next » 

Revision 2837

sql_gen.py: CompareCond.to_str(): Handle nullable columns using ensure_not_null()

View differences:

lib/sql_gen.py
403 403
        check_null = False
404 404
        if equals and not passthru_null_ref[0] and isinstance(right_value, Col):
405 405
            check_null = True
406
            try:
407
                left_non_null = ensure_not_null(db, left_value)
408
                right_non_null = ensure_not_null(db, right_value)
409
            except NoUnderlyingTableException: pass
410
            else:
411
                if (left_non_null is not left_value
412
                    and right_non_null is not right_value): # both were wrapped
413
                    check_null = False # wrapping makes extra check unnecessary
414
                    left_value = left_non_null
415
                    right_value = right_non_null
406 416
        
407 417
        left = left_value.to_str(db)
408 418
        right = right_value.to_str(db)

Also available in: Unified diff