summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-09-22 01:12:00 +0200
committerSergei Golubchik <serg@mariadb.org>2017-09-22 13:58:00 +0200
commitbc4409ab4ee3729f09151a4d7bdc6d95fdcaa3a1 (patch)
treec4b485a50df1e5ee8608d6d10599b250df65203d /sql/field.cc
parentf1ce69f3a9c01877c588c28eab9484fba8cd0e56 (diff)
downloadmariadb-git-bc4409ab4ee3729f09151a4d7bdc6d95fdcaa3a1.tar.gz
MDEV-13868 cannot insert 1288481126 in a timestamp column in Europe/Moscow
make insert NULL into a timestamp mark the field as having an explicit value. So that the field won't be assigned the value again in TABLE::update_default_field() make Item_func_now_local::save_in_field(timestamp_field) not to go through MYSQL_TIME - this conversion is lossy around DST change times. This fixes inserting a default value into a timestamp field.
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc30
1 files changed, 0 insertions, 30 deletions
diff --git a/sql/field.cc b/sql/field.cc
index a872fab2520..f4775ef7128 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -5260,36 +5260,6 @@ int Field_timestamp::set_time()
return 0;
}
-/**
- Mark the field as having an explicit default value.
-
- @param value if available, the value that the field is being set to
- @returns whether the explicit default bit was set
-
- @note
- Fields that have an explicit default value should not be updated
- automatically via the DEFAULT or ON UPDATE functions. The functions
- that deal with data change functionality (INSERT/UPDATE/LOAD),
- determine if there is an explicit value for each field before performing
- the data change, and call this method to mark the field.
-
- For timestamp columns, the only case where a column is not marked
- as been given a value are:
- - It's explicitly assigned with DEFAULT
- - We assign NULL to a timestamp field that is defined as NOT NULL.
- This is how MySQL has worked since it's start.
-*/
-
-bool Field_timestamp::set_explicit_default(Item *value)
-{
- if (((value->type() == Item::DEFAULT_VALUE_ITEM &&
- !((Item_default_value*)value)->arg) ||
- (!maybe_null() && value->null_value)))
- return false;
- set_has_explicit_value();
- return true;
-}
-
#ifdef NOT_USED
static void store_native(ulonglong num, uchar *to, uint bytes)
{