mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Bug#35981: ALTER EVENT causes the server to change the PRESERVE option.
If [NOT] PRESERVE was not given, parser always defaulted to NOT PRESERVE, making it impossible for the "not given = no change" rule to work in ALTER EVENT. Leaving out the PRESERVE-clause defaults to NOT PRESERVE on CREATE now, and to "no change" in ALTER. mysql-test/r/events_2.result: show that giving no PRESERVE-clause to ALTER EVENT results in no change. show that giving no PRESERVE-clause to CREATE EVENT defaults to NOT PRESERVE as per the docs. Show specifically that this is also handled correctly when trying to ALTER EVENTs into the past. mysql-test/t/events_2.test: show that giving no PRESERVE-clause to ALTER EVENT results in no change. show that giving no PRESERVE-clause to CREATE EVENT defaults to NOT PRESERVE as per the docs. Show specifically that this is also handled correctly when trying to ALTER EVENTs into the past. sql/event_db_repository.cc: If ALTER EVENT was given no PRESERVE-clause (meaning "no change"), we don't know the previous PRESERVE-setting by the time we check the parse-data. If ALTER EVENT was given dates that are in the past, we don't know how to react, lacking the PRESERVE-setting. Heal this by running the check later when we have actually read the previous EVENT-data. sql/event_parse_data.cc: Change default for ON COMPLETION to indicate, "not specified." Also defer throwing errors when ALTER EVENT is given dates in the past but not PRESERVE-clause until we know the previous PRESERVE-value. sql/event_parse_data.h: Add third state for ON COMPLETION [NOT] PRESERVE (preserve, don't, not specified). Make check_dates() public so we can defer this check until deeper in the callstack where we have all the required data. sql/sql_yacc.yy: If CREATE EVENT is not given ON COMPLETION [NOT] PRESERVE, we default to NOT, as per the docs.
This commit is contained in:
@ -38,7 +38,12 @@ public:
|
||||
|
||||
enum enum_on_completion
|
||||
{
|
||||
ON_COMPLETION_DROP = 1,
|
||||
/*
|
||||
On CREATE EVENT, DROP is the DEFAULT as per the docs.
|
||||
On ALTER EVENT, "no change" is the DEFAULT.
|
||||
*/
|
||||
ON_COMPLETION_DEFAULT = 0,
|
||||
ON_COMPLETION_DROP,
|
||||
ON_COMPLETION_PRESERVE
|
||||
};
|
||||
|
||||
@ -80,6 +85,9 @@ public:
|
||||
bool
|
||||
check_parse_data(THD *thd);
|
||||
|
||||
bool
|
||||
check_dates(THD *thd, int previous_on_completion);
|
||||
|
||||
private:
|
||||
|
||||
void
|
||||
|
Reference in New Issue
Block a user