summaryrefslogtreecommitdiff
path: root/mysql-test/main/type_timestamp.result
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2020-06-10 13:55:55 +0400
committerAlexander Barkov <bar@mariadb.com>2020-06-10 13:55:55 +0400
commitbf2a244406c36cd12bc53f9a30c8a2cab191f235 (patch)
tree50309b72c7365c3db451aba16751e8bee1b3826c /mysql-test/main/type_timestamp.result
parent86c50a255a8319a4c89399b9c2d4f416b4973815 (diff)
downloadmariadb-git-bf2a244406c36cd12bc53f9a30c8a2cab191f235.tar.gz
MDEV-22854 Garbage returned with SELECT CASE..DEFAULT(timestamp_field_with_now_as_default)
Item_default_value did not override val_native(), so the inherited Item_field::val_native() was called. As a result Item_default_value::calculate() was not called and Item_field::val_native() was called on a Field with a non-initialized ptr. Implementing Item_default_value::val_native() properly.
Diffstat (limited to 'mysql-test/main/type_timestamp.result')
-rw-r--r--mysql-test/main/type_timestamp.result12
1 files changed, 12 insertions, 0 deletions
diff --git a/mysql-test/main/type_timestamp.result b/mysql-test/main/type_timestamp.result
index 11d27e77a3d..e6fa9756b1d 100644
--- a/mysql-test/main/type_timestamp.result
+++ b/mysql-test/main/type_timestamp.result
@@ -1308,5 +1308,17 @@ Warnings:
Warning 1292 Incorrect datetime value: '2010-00-01 00:00:00'
DROP TABLE t1;
#
+# MDEV-22854 Garbage returned with SELECT CASE..DEFAULT(timestamp_field_with_now_as_default)
+#
+SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30.456789');
+CREATE TABLE t1 (a TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP);
+INSERT INTO t1 VALUES ('2019-02-23 11:31:04'),('2023-02-09 00:00:00');
+SELECT CASE WHEN a THEN DEFAULT(a) END FROM t1;
+CASE WHEN a THEN DEFAULT(a) END
+2001-01-01 10:20:30.456
+2001-01-01 10:20:30.456
+DROP TABLE t1;
+SET timestamp=DEFAULT;
+#
# End of 10.4 tests
#