Skip to content
  • Jon Olav Hauglid's avatar
    79447946
    Bug#14756206: ALTER TABLE: MYSQL_CREATE_FRM DOESN'T CLEAN · 79447946
    Jon Olav Hauglid authored
                  UP PROPERLY, MEMORY LEAKED
    
    This memory leak happend if ALTER TABLE ... SET DEFAULT was
    used to set a default value for a TINY|MEDIUM|LONG BLOB|TEXT
    column.
    
    According to the manual,
    "BLOB and TEXT columns cannot be assigned a default value."
    This was true for CREATE TABLE and ALTER TABLE ADD/MODIFY
    COLUMN. However, for ALTER TABLE ... SET DEFAULT it was only
    enforced for plain BLOB|TEXT columns and not for their 
    tiny/medium/long variations.
    
    When creating the record buffer for the default values of
    blob columns (represented internally by Field_blob),
    Field_blob::free() and ~Field_blob() were never called and
    memory allocated for Field_blob::value was therefore never
    released.
    
    This patch fixes the problem by reporting
    ER_BLOB_CANT_HAVE_DEFAULT error for TINY|MEDIUM|LONG BLOB|TEXT
    columns, similarly to what is already done for BLOB|TEXT columns
    and similar to what is already done for CREATE TABLE and
    ALTER TABLE ADD/MODIFY COLUMN.
    
    Note that this also disallows ALTER TABLE ... SET DEFAULT NULL
    for geometry column types (Field_geom). Such columns are 
    not supposed to support SET DEFAULT and everything but
    SET DEFAULT NULL was already disallowed.
    79447946
    Bug#14756206: ALTER TABLE: MYSQL_CREATE_FRM DOESN'T CLEAN
    Jon Olav Hauglid authored
                  UP PROPERLY, MEMORY LEAKED
    
    This memory leak happend if ALTER TABLE ... SET DEFAULT was
    used to set a default value for a TINY|MEDIUM|LONG BLOB|TEXT
    column.
    
    According to the manual,
    "BLOB and TEXT columns cannot be assigned a default value."
    This was true for CREATE TABLE and ALTER TABLE ADD/MODIFY
    COLUMN. However, for ALTER TABLE ... SET DEFAULT it was only
    enforced for plain BLOB|TEXT columns and not for their 
    tiny/medium/long variations.
    
    When creating the record buffer for the default values of
    blob columns (represented internally by Field_blob),
    Field_blob::free() and ~Field_blob() were never called and
    memory allocated for Field_blob::value was therefore never
    released.
    
    This patch fixes the problem by reporting
    ER_BLOB_CANT_HAVE_DEFAULT error for TINY|MEDIUM|LONG BLOB|TEXT
    columns, similarly to what is already done for BLOB|TEXT columns
    and similar to what is already done for CREATE TABLE and
    ALTER TABLE ADD/MODIFY COLUMN.
    
    Note that this also disallows ALTER TABLE ... SET DEFAULT NULL
    for geometry column types (Field_geom). Such columns are 
    not supposed to support SET DEFAULT and everything but
    SET DEFAULT NULL was already disallowed.
Loading