Skip to content
  • Catalin Besleaga's avatar
    595be00e
    WL#9418: Permit default value to be a function or expression · 595be00e
    Catalin Besleaga authored
    Currently MySQL only permits a literal value as column default. This WL
    is removing this limitation by also allowing expressions to generate
    values as DEFAULT. With these changes the following syntax for
    defining/altering a column will be allowed:
    <column name> <column data type> DEFAULT (expression)
    
    This worklog reuses some of the infrastructure around Generated Columns
    and expands the range of functions that can be used as default
    expressions by also allowing the following non-deterministic functions:
    uuid, rand, statement_digest, statement_digest_text, curdate,
    current_date, curtime, current_time, current_timestamp, localtime,
    localtimestamp, now, sysdate, unix_timestamp, utc_date, utc_time,
    utc_timestamp, connection_id, database.
    Also all the deterministic functions that were previously allowed for
    Generated Columns are also allowed as default expressions.
    
    Change-Id: Ieeb72efd87ae3e98349a257c40061bcf2d3ddb22
    595be00e
    WL#9418: Permit default value to be a function or expression
    Catalin Besleaga authored
    Currently MySQL only permits a literal value as column default. This WL
    is removing this limitation by also allowing expressions to generate
    values as DEFAULT. With these changes the following syntax for
    defining/altering a column will be allowed:
    <column name> <column data type> DEFAULT (expression)
    
    This worklog reuses some of the infrastructure around Generated Columns
    and expands the range of functions that can be used as default
    expressions by also allowing the following non-deterministic functions:
    uuid, rand, statement_digest, statement_digest_text, curdate,
    current_date, curtime, current_time, current_timestamp, localtime,
    localtimestamp, now, sysdate, unix_timestamp, utc_date, utc_time,
    utc_timestamp, connection_id, database.
    Also all the deterministic functions that were previously allowed for
    Generated Columns are also allowed as default expressions.
    
    Change-Id: Ieeb72efd87ae3e98349a257c40061bcf2d3ddb22
Loading