Commit f2094d74 authored by unknown's avatar unknown

Merge mysql.com:/usr_rh9/home/elkin.rh9/MySQL/FIXES/5.0.20-bug15101-sysdate

into  mysql.com:/usr_rh9/home/elkin.rh9/MySQL/Merge/5.1


sql/mysqld.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
parents 8a7c1e73 8f543b5e
set timestamp=1;
SELECT sleep(1),NOW()-SYSDATE() as zero;
sleep(1) zero
0 0
#
# BUG#15101 restore aliasing of SYSDATE to NOW in 5.0
# this feature is activated via --sysdate-is-now mysqld init opt
#
# To test here
# 1. SYSDATE() does not distiguish from NOW()
# 2. SYSDATE() obeys set timestamp
set timestamp=1;
SELECT sleep(1),NOW()-SYSDATE() as zero;
# End of 5.0 tests
......@@ -4800,6 +4800,7 @@ enum options_mysqld
OPT_DATETIME_FORMAT,
OPT_LOG_QUERIES_NOT_USING_INDEXES,
OPT_DEFAULT_TIME_ZONE,
OPT_SYSDATE_IS_NOW,
OPT_OPTIMIZER_SEARCH_DEPTH,
OPT_OPTIMIZER_PRUNE_LEVEL,
OPT_UPDATABLE_VIEWS_WITH_LIMIT,
......@@ -6291,6 +6292,10 @@ The minimum value for this variable is 4096.",
(gptr*) &max_system_variables.net_wait_timeout, 0, GET_ULONG,
REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, IF_WIN(INT_MAX32/1000, LONG_TIMEOUT),
0, 1, 0},
{"sysdate-is-now", OPT_SYSDATE_IS_NOW,
"Non-default flag to alias SYSDATE() to NOW() to be safe-replicatable. Since 5.0 SYSDATE returns a `dynamic' value different for different invocation even within a query",
(gptr*) &global_system_variables.sysdate_is_now,
0, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
......
......@@ -276,6 +276,7 @@ struct system_variables
DATE_TIME_FORMAT *date_format;
DATE_TIME_FORMAT *datetime_format;
DATE_TIME_FORMAT *time_format;
my_bool sysdate_is_now;
};
......
......@@ -6342,9 +6342,19 @@ simple_expr:
| SUBSTRING_INDEX '(' expr ',' expr ',' expr ')'
{ $$= new Item_func_substr_index($3,$5,$7); }
| SYSDATE optional_braces
{ $$= new Item_func_sysdate_local(); Lex->safe_to_cache_query=0;}
{
if (global_system_variables.sysdate_is_now == 0)
$$= new Item_func_sysdate_local();
else $$= new Item_func_now_local();
Lex->safe_to_cache_query=0;
}
| SYSDATE '(' expr ')'
{ $$= new Item_func_sysdate_local($3); Lex->safe_to_cache_query=0;}
{
if (global_system_variables.sysdate_is_now == 0)
$$= new Item_func_sysdate_local($3);
else $$= new Item_func_now_local($3);
Lex->safe_to_cache_query=0;
}
| TIME_SYM '(' expr ')'
{ $$= new Item_time_typecast($3); }
| TIMESTAMP '(' expr ')'
......
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