• Alexey Kopytov's avatar
    Bug #42849: innodb crash with varying time_zone on partitioned · a8cfe3d4
    Alexey Kopytov authored
                timestamp primary key 
     
    Since TIMESTAMP values are adjusted by the current time zone  
    settings in both numeric and string contexts, using any 
    expressions involving TIMESTAMP values as a  
    (sub)partitioning function leads to undeterministic behavior of  
    partitioned tables. The effect may vary depending on a storage  
    engine, it can be either incorrect data being retrieved or  
    stored, or an assertion failure. The root cause of this is the  
    fact that the calculated partition ID may differ from a  
    previously calculated ID for the same data due to timezone  
    adjustments of the partitioning expression value. 
     
    Fixed by disabling any expressions involving TIMESTAMP values  
    to be used in partitioning functions with the follwing two 
    exceptions: 
     
    1. Creating or altering into a partitioned table that violates 
    the above rule is not allowed, but opening existing such tables 
    results in a warning rather than an error so that such tables 
    could be fixed. 
     
    2. UNIX_TIMESTAMP() is the only way to get a 
    timezone-independent value from a TIMESTAMP column, because it 
    returns the internal representation (a time_t value) of a 
    TIMESTAMP argument verbatim. So UNIX_TIMESTAMP(timestamp_column)
    is allowed and should be used to fix existing tables if one 
    wants to use TIMESTAMP columns with partitioning.
    a8cfe3d4
sql_yacc.yy 400 KB