diff options
author | Tatiana A. Nurnberg <azundris@mysql.com> | 2008-08-18 13:05:51 +0200 |
---|---|---|
committer | Tatiana A. Nurnberg <azundris@mysql.com> | 2008-08-18 13:05:51 +0200 |
commit | 02f305516f3663533ca9abd68e73a64f7da51455 (patch) | |
tree | a90a32a0037c8098ecdf38ab6760130373cb10c8 /mysql-test/r/events_2.result | |
parent | e3320457e11fdfc2ac76d75dfb7e8a88d535b97b (diff) | |
download | mariadb-git-02f305516f3663533ca9abd68e73a64f7da51455.tar.gz |
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.
Diffstat (limited to 'mysql-test/r/events_2.result')
-rw-r--r-- | mysql-test/r/events_2.result | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/mysql-test/r/events_2.result b/mysql-test/r/events_2.result index 64d643505c5..db503f7aa6d 100644 --- a/mysql-test/r/events_2.result +++ b/mysql-test/r/events_2.result @@ -328,4 +328,81 @@ create event очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66 on schedule every 2 year do select 1; ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long +create event event_35981 on schedule every 6 month on completion preserve +disable +do +select 1; +The following SELECTs should all give 1 +select count(*) from information_schema.events +where event_schema = database() and event_name = 'event_35981' and +on_completion = 'PRESERVE'; +count(*) +1 +alter event event_35981 enable; +select count(*) from information_schema.events +where event_schema = database() and event_name = 'event_35981' and +on_completion = 'PRESERVE'; +count(*) +1 +alter event event_35981 on completion not preserve; +select count(*) from information_schema.events +where event_schema = database() and event_name = 'event_35981' and +on_completion = 'NOT PRESERVE'; +count(*) +1 +alter event event_35981 disable; +select count(*) from information_schema.events +where event_schema = database() and event_name = 'event_35981' and +on_completion = 'NOT PRESERVE'; +count(*) +1 +alter event event_35981 on completion preserve; +select count(*) from information_schema.events +where event_schema = database() and event_name = 'event_35981' and +on_completion = 'PRESERVE'; +count(*) +1 +drop event event_35981; +create event event_35981 on schedule every 6 month disable +do +select 1; +select count(*) from information_schema.events +where event_schema = database() and event_name = 'event_35981' and +on_completion = 'NOT PRESERVE'; +count(*) +1 +drop event event_35981; +create event event_35981 on schedule every 1 hour starts current_timestamp +on completion not preserve +do +select 1; +alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00' + ends '1999-01-02 00:00:00'; +ERROR HY000: Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation. +drop event event_35981; +create event event_35981 on schedule every 1 hour starts current_timestamp +on completion not preserve +do +select 1; +alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00' + ends '1999-01-02 00:00:00' on completion preserve; +Warnings: +Note 1544 Event execution time is in the past. Event has been disabled +drop event event_35981; +create event event_35981 on schedule every 1 hour starts current_timestamp +on completion preserve +do +select 1; +alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00' + ends '1999-01-02 00:00:00'; +Warnings: +Note 1544 Event execution time is in the past. Event has been disabled +alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00' + ends '1999-01-02 00:00:00' on completion not preserve; +ERROR HY000: Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation. +alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00' + ends '1999-01-02 00:00:00' on completion preserve; +Warnings: +Note 1544 Event execution time is in the past. Event has been disabled +drop event event_35981; drop database events_test; |