Skip to content
  • Guilhem Bichot's avatar
    203d0383
    Bug#21922414 CAST OF TOO BIG HEX LITERAL TO BIGINT UNSIGNED: BAD RESULT AND NO... · 203d0383
    Guilhem Bichot authored
    Bug#21922414 CAST OF TOO BIG HEX LITERAL TO BIGINT UNSIGNED: BAD RESULT AND NO WARNING Bug#11757477 ARITHMETIC ERROR WHEN DEALING WITH BIGINT
    
    Problem 1:
    Item_hex_string::val_int() silently ignored any bytes except the last 8.
    Fix: raise truncation warning if ignored bytes are non-zero.
    
    Problem 2:
    Hex_literal + int
    was considered as binary + int in the sense that the result type was
    DOUBLE.
    The manual says that in numeric context, hex literal is 64-bit int;
    reading the ctor also adds that it's then unsigned (unsigned_flag=1).
    Fix: give it an implementation of numeric_context_result_type().
    Consequence on parser_precedence.test: some calculations done
    as DOUBLE are now done as BIGINT UNSIGNED so they don't permit
    a substraction with negative result. Fixed by changing values;
    intention of the test is preserved.
    203d0383
    Bug#21922414 CAST OF TOO BIG HEX LITERAL TO BIGINT UNSIGNED: BAD RESULT AND NO...
    Guilhem Bichot authored
    Bug#21922414 CAST OF TOO BIG HEX LITERAL TO BIGINT UNSIGNED: BAD RESULT AND NO WARNING Bug#11757477 ARITHMETIC ERROR WHEN DEALING WITH BIGINT
    
    Problem 1:
    Item_hex_string::val_int() silently ignored any bytes except the last 8.
    Fix: raise truncation warning if ignored bytes are non-zero.
    
    Problem 2:
    Hex_literal + int
    was considered as binary + int in the sense that the result type was
    DOUBLE.
    The manual says that in numeric context, hex literal is 64-bit int;
    reading the ctor also adds that it's then unsigned (unsigned_flag=1).
    Fix: give it an implementation of numeric_context_result_type().
    Consequence on parser_precedence.test: some calculations done
    as DOUBLE are now done as BIGINT UNSIGNED so they don't permit
    a substraction with negative result. Fixed by changing values;
    intention of the test is preserved.
Loading