diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index afd8c3430b3..96bca4ca8f7 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -1784,6 +1784,24 @@ select @x| @x 3 drop procedure bug5307| +create procedure bug5258() +begin +end| +create procedure bug5258_aux() +begin +declare c, m char(19); +select created,modified into c,m from mysql.proc where name = 'bug5258'; +if c = m then +select 'Ok'; +else +select c, m; +end if; +end| +call bug5258_aux()| +Ok +Ok +drop procedure bug5258| +drop procedure bug5258_aux| drop table if exists fac| create table fac (n int unsigned not null primary key, f bigint unsigned)| create procedure ifac(n int unsigned) diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 92d6110cf7a..4c5e0c483ba 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -1953,6 +1953,30 @@ call bug5307()| select @x| drop procedure bug5307| +# +# BUG#5258: Stored procedure modified date is 0000-00-00 +# (This was a design flaw) +create procedure bug5258() +begin +end| + +create procedure bug5258_aux() +begin + declare c, m char(19); + + select created,modified into c,m from mysql.proc where name = 'bug5258'; + if c = m then + select 'Ok'; + else + select c, m; + end if; +end| + +call bug5258_aux()| + +drop procedure bug5258| +drop procedure bug5258_aux| + # # Some "real" examples diff --git a/sql/sp.cc b/sql/sp.cc index cd52cff90a3..41d07bb9d40 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -371,6 +371,7 @@ db_create_routine(THD *thd, int type, sp_head *sp) table->field[MYSQL_PROC_FIELD_DEFINER]-> store(definer, (uint)strlen(definer), system_charset_info); ((Field_timestamp *)table->field[MYSQL_PROC_FIELD_CREATED])->set_time(); + ((Field_timestamp *)table->field[MYSQL_PROC_FIELD_MODIFIED])->set_time(); table->field[MYSQL_PROC_FIELD_SQL_MODE]-> store((longlong)thd->variables.sql_mode); if (sp->m_chistics->comment.str)