summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <cmiller@zippy.cornsilk.net>2006-11-09 18:33:58 -0500
committerunknown <cmiller@zippy.cornsilk.net>2006-11-09 18:33:58 -0500
commit19d61b1b81fdcfed3986f37e7677f6bcc7e7c6aa (patch)
tree489166e5267286ba6c0dd121f5990c32a90f72cd /sql
parente3f0e67b8fbe5c6b020dec8daf0f3622202e8911 (diff)
downloadmariadb-git-19d61b1b81fdcfed3986f37e7677f6bcc7e7c6aa.tar.gz
Bug#20691: DATETIME col (NOT NULL, NO DEFAULT) may insert garbage when \
specifying DEFAULT This was not specific to datetime. When there is no default value for a column, and the user inserted DEFAULT, we would write uninitialized memory to the table. Now, insist on writing a default value, a zero-ish value, the same one that comes from inserting NULL into a not-NULL field. (This is, at best, really strange behavior that comes from allowing sloppy usage, and serves as a good reason always to run one's server in a strict SQL mode.) mysql-test/r/default.result: Verify that all kinds of types work, even others other than datetime. mysql-test/t/default.test: Verify that all kinds of types work, even others other than datetime. sql/item.cc: Even if we warn that there is no default value in the table definition, we have to insert /something/.
Diffstat (limited to 'sql')
-rw-r--r--sql/item.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/item.cc b/sql/item.cc
index d56ca95093b..d181edb4ecd 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -5379,6 +5379,7 @@ int Item_default_value::save_in_field(Field *field_arg, bool no_conversions)
ER(ER_NO_DEFAULT_FOR_FIELD),
field_arg->field_name);
}
+ field_arg->set_default();
return 1;
}
field_arg->set_default();