Commit dd41fd57 authored by thek@kpdesk.mysql.com's avatar thek@kpdesk.mysql.com

Bug#23240 --init-file statements with NOW() reports '1970-01-01 11:00:00'as the date time

- Starting time of a query sent by file bootstrapping wasn't initialized
  and starting time defaulted to 0. This later used value by the Now-
  item and is translated to 1970-01-01 11:00:00.
- marking the time with thd->set_time() before the call to 
  mysql_parse resolves this issue.
parent 928d672c
INSERT INTO init_file.startup VALUES ( NOW() );
SELECT * INTO @X FROM init_file.startup limit 0,1;
SELECT * INTO @Y FROM init_file.startup limit 1,1;
SELECT YEAR(@X)-YEAR(@Y);
YEAR(@X)-YEAR(@Y)
0
DROP DATABASE init_file;
ok ok
End of 4.1 tests End of 4.1 tests
select * from mysql.user as t1, mysql.user as t2, mysql.user as t3; select * from mysql.user as t1, mysql.user as t2, mysql.user as t3;
#
# Bug#23240 --init-file statements with NOW() reports '1970-01-01 11:00:00'as the date time
#
CREATE DATABASE IF NOT EXISTS init_file;
CREATE TABLE IF NOT EXISTS init_file.startup ( startdate DATETIME );
INSERT INTO init_file.startup VALUES ( NOW() );
...@@ -6,5 +6,14 @@ ...@@ -6,5 +6,14 @@
# mysql-test/t/init_file-master.opt for the actual test # mysql-test/t/init_file-master.opt for the actual test
# #
#
# Bug#23240 --init-file statements with NOW() reports '1970-01-01 11:00:00'as the date time
#
INSERT INTO init_file.startup VALUES ( NOW() );
SELECT * INTO @X FROM init_file.startup limit 0,1;
SELECT * INTO @Y FROM init_file.startup limit 1,1;
SELECT YEAR(@X)-YEAR(@Y);
DROP DATABASE init_file;
--echo ok --echo ok
--echo End of 4.1 tests --echo End of 4.1 tests
...@@ -1175,6 +1175,7 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg) ...@@ -1175,6 +1175,7 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg)
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC)); free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
break; break;
} }
thd->set_time();
mysql_parse(thd,thd->query,length); mysql_parse(thd,thd->query,length);
close_thread_tables(thd); // Free tables close_thread_tables(thd); // Free tables
if (thd->is_fatal_error) if (thd->is_fatal_error)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment