mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
values for TIMESTAMP columns. The solution is not perfect since we just silently ignoring default value for first TIMESTAMP column and properly reflecting this fact in SHOW CREATE TABLE. We can't give a warning or simply support standard syntax (niladic functions as legal value for default) for first field since it is 4.0 tree. mysql-test/r/type_timestamp.result: Added test for bugs #1885, #2464, #2539 (proper support of default values for TIMESTAMP columns) mysql-test/t/type_timestamp.test: Added test for bugs #1885, #2464, #2539 (proper support of default values for TIMESTAMP columns) sql/field.cc: Enabled copying of defaults for TIMESTAMP fields when we are creating table with CREATE TABLE x (SELECT ...) sql/field.h: Set proper DEFAULT value for non-first TIMESTAMP column. sql/sql_parse.cc: Allowed default values for TIMESTAMP column. sql/sql_show.cc: Enabled printing of default values in SHOW CREATE TABLE and SHOW COLUMNS for all TIMESTAMP columns except first one.
This commit is contained in:
@ -3056,12 +3056,12 @@ bool add_field_to_list(char *field_name, enum_field_types type,
|
||||
|
||||
if (default_value)
|
||||
{
|
||||
if (type == FIELD_TYPE_TIMESTAMP)
|
||||
{
|
||||
net_printf(&thd->net, ER_INVALID_DEFAULT, field_name);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
else if (default_value->type() == Item::NULL_ITEM)
|
||||
/*
|
||||
We allow specifying value for first TIMESTAMP column
|
||||
altough it is silently ignored. This should be fixed in 4.1
|
||||
(by proper warning or real support for default values)
|
||||
*/
|
||||
if (default_value->type() == Item::NULL_ITEM)
|
||||
{
|
||||
default_value=0;
|
||||
if ((type_modifier & (NOT_NULL_FLAG | AUTO_INCREMENT_FLAG)) ==
|
||||
|
Reference in New Issue
Block a user