diff options
author | unknown <dlenev@brandersnatch.localdomain> | 2004-10-05 21:23:38 +0400 |
---|---|---|
committer | unknown <dlenev@brandersnatch.localdomain> | 2004-10-05 21:23:38 +0400 |
commit | f092fd5e21903c9c953fd649256dbefa895a15e4 (patch) | |
tree | d6accd9f1d04290c7bd48b00a643b0a1fe7a1fff /sql | |
parent | 4535f80e600f93eb200f3bd40d74dd341d75929b (diff) | |
download | mariadb-git-f092fd5e21903c9c953fd649256dbefa895a15e4.tar.gz |
Fixed small bug in handling of pre-4.1 TIMESTAMP columns which was
introduced during implementation of TIMESTAMP columns, which are able
to store NULLs (Unfortunately it is impossible to write test case for
this. Kudos to Holyfoot for noticing it!)
sql/field.cc:
Field_timestamp::get_auto_set_type(): To preserve compatibility
with pre-4.1 we have to handle TIMESTAMP_OLD_FIELD columns properly.
(It is ok to handle them as TIMESTAMP_DNUN_FIELD since value of first
such column should be set to current timestamp on both INSERT and UPDATE
operations, and we don't call this method for rest of them).
Diffstat (limited to 'sql')
-rw-r--r-- | sql/field.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sql/field.cc b/sql/field.cc index eaa1ca2bcca..b394a155ddb 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -2970,6 +2970,14 @@ timestamp_auto_set_type Field_timestamp::get_auto_set_type() const return TIMESTAMP_AUTO_SET_ON_INSERT; case TIMESTAMP_UN_FIELD: return TIMESTAMP_AUTO_SET_ON_UPDATE; + case TIMESTAMP_OLD_FIELD: + /* + Altough we can have several such columns in legacy tables this + function should be called only for first of them (i.e. the one + having auto-set property). + */ + DBUG_ASSERT(table->timestamp_field == this); + /* Fall-through */ case TIMESTAMP_DNUN_FIELD: return TIMESTAMP_AUTO_SET_ON_BOTH; default: |