Skip to content
  • Nisha Gopalakrishnan's avatar
    6a587702
    BUG#16888677: OUT OF RANGE VALUE ACCEPTED FOR DATETIME · 6a587702
    Nisha Gopalakrishnan authored
                  COLUMN IN ALTER TABLE...ADD COLUMN
    
    Analysis:
    ========
    
    ISSUE1:
    ALTER TABLE, INPLACE operation to add a DATE/DATETIME column fails
    to report an error  when:
    a) Field is NOT NULL and DEFAULT value is not supplied.
    b) Strict and 'NO_ZERO_DATE' sql modes are enabled.
    c) Table is not empty.
    
    ISSUE2:
    ALTER TABLE, INPLACE/COPY to add a DATE/DATETIME column fails with
    an error:
    a) Field is NOT NULL and DEFAULT value is not supplied.
    b) Only strict mode is enabled.
    c) Table is not empty.
    
    The 'mysql_inplace_alter_table()' function did not handle the
    condition mentioned in issue1 in order to report an error. A flag
    'error_if_not_empty' is set  when the conditions mentioned in
    issue1 occurs. This flag was not checked in
    'mysql_inplace_alter_table()' to raise an error.
    
    When only strict mode is enabled, the operation mentioned in
    ISSUE2 is supposed to succeed. But 'mysql_prepare_alter_table',
    checked for strict mode rather than 'NO_ZERO_DATE' when setting
    the flag 'error_if_not_empty'. Thus the operation failed reporting
    an error.
    
    Fix:
    ===
    ISSUE1: The 'mysql_inplace_alter_table()' is modified to check for the
            flag 'error_if_not_empty' and raise an error if the conditions
            mentioned in ISSUE1 occurs.
    ISSUE2: 'mysql_prepare_alter_table()', has been modified to remove the
            check for strict mode while setting the 'error_if_not_empty'
            to report warning/error as appropriate.
    6a587702
    BUG#16888677: OUT OF RANGE VALUE ACCEPTED FOR DATETIME
    Nisha Gopalakrishnan authored
                  COLUMN IN ALTER TABLE...ADD COLUMN
    
    Analysis:
    ========
    
    ISSUE1:
    ALTER TABLE, INPLACE operation to add a DATE/DATETIME column fails
    to report an error  when:
    a) Field is NOT NULL and DEFAULT value is not supplied.
    b) Strict and 'NO_ZERO_DATE' sql modes are enabled.
    c) Table is not empty.
    
    ISSUE2:
    ALTER TABLE, INPLACE/COPY to add a DATE/DATETIME column fails with
    an error:
    a) Field is NOT NULL and DEFAULT value is not supplied.
    b) Only strict mode is enabled.
    c) Table is not empty.
    
    The 'mysql_inplace_alter_table()' function did not handle the
    condition mentioned in issue1 in order to report an error. A flag
    'error_if_not_empty' is set  when the conditions mentioned in
    issue1 occurs. This flag was not checked in
    'mysql_inplace_alter_table()' to raise an error.
    
    When only strict mode is enabled, the operation mentioned in
    ISSUE2 is supposed to succeed. But 'mysql_prepare_alter_table',
    checked for strict mode rather than 'NO_ZERO_DATE' when setting
    the flag 'error_if_not_empty'. Thus the operation failed reporting
    an error.
    
    Fix:
    ===
    ISSUE1: The 'mysql_inplace_alter_table()' is modified to check for the
            flag 'error_if_not_empty' and raise an error if the conditions
            mentioned in ISSUE1 occurs.
    ISSUE2: 'mysql_prepare_alter_table()', has been modified to remove the
            check for strict mode while setting the 'error_if_not_empty'
            to report warning/error as appropriate.
Loading