• unknown's avatar
    Fixes bug #14569. When no db is selected as current and we do create procedure db.sp()... · 1c677f8c
    unknown authored
    we changing current db temporarily and restore it when sp is created. however thd->db
    in this case becomes empty string rather than NULL and so all checks of thd->db == NULL 
    will be false. So if after this we'll issue create procedure sp2()... without specifying
    db it will succeed and create sp with db=NULL, which causes mysqldto crash on 
    show procedure status statement.
    
    This patch fixes the problem.
    
    
    mysql-test/r/sp-error.result:
      Result for bug #14569.
    mysql-test/t/sp-error.test:
      Test for bug #14569.
    sql/sql_db.cc:
      Fixes bug #14569. When no db is selected as current and we do create procedure db.sp()...
      we changing current db temporarily and restore it when sp is created. however thd->db
      in this case becomes empty string rather than NULL and so all checks of thd->db == NULL 
      will be false. This patch fixes this issue.
    sql/sql_parse.cc:
      Fixes bug #14569. Reverted from initial patch to check thd->db for null values only.
    1c677f8c
sp-error.test 25.9 KB