Skip to content
  • Tor Didriksen's avatar
    bf2d0bf5
    Bug#11758319 BEHAVIOR OF LOGARITHMIC FUNCTIONS DEPENDS ON ERROR_FOR_DIVISION_BY_ZERO · bf2d0bf5
    Tor Didriksen authored
    Bug#50507 Behavior of logarithmic functions depends on ERROR_FOR_DIVISION_BY_ZERO
    
    The manual says that if the argument of LN(), LOG2(), LOG10() or LOG()
    functions is less than or equal to 0, then NULL is returned.
    
    However, if the ERROR_FOR_DIVISION_BY_ZERO server SQL mode is enabled, those
    functions return the "division by zero" error when in strict mode (or a
    warning otherwise) instead of NULL. This is counter-intuitive and not
    documented.
    
    Fix: introduce signal_invalid_argument_for_log() which reports
    "Invalid argument for logarithm" rather than "Division by 0"
    
    Bug#50507 asked for Returning NULL regardless of the SQL mode.
    This patch returns an error if strict mode is enabled.
    This is in line with WL#7467 which will remove ERROR_FOR_DIVISION_BY_ZERO
    and make it part of strict mode.
    bf2d0bf5
    Bug#11758319 BEHAVIOR OF LOGARITHMIC FUNCTIONS DEPENDS ON ERROR_FOR_DIVISION_BY_ZERO
    Tor Didriksen authored
    Bug#50507 Behavior of logarithmic functions depends on ERROR_FOR_DIVISION_BY_ZERO
    
    The manual says that if the argument of LN(), LOG2(), LOG10() or LOG()
    functions is less than or equal to 0, then NULL is returned.
    
    However, if the ERROR_FOR_DIVISION_BY_ZERO server SQL mode is enabled, those
    functions return the "division by zero" error when in strict mode (or a
    warning otherwise) instead of NULL. This is counter-intuitive and not
    documented.
    
    Fix: introduce signal_invalid_argument_for_log() which reports
    "Invalid argument for logarithm" rather than "Division by 0"
    
    Bug#50507 asked for Returning NULL regardless of the SQL mode.
    This patch returns an error if strict mode is enabled.
    This is in line with WL#7467 which will remove ERROR_FOR_DIVISION_BY_ZERO
    and make it part of strict mode.
Loading