The code in sp_create_routine() uses two ways to access the routine name:
- Via sp_head: sp->m_db and sp->m_name
- Via LEX: lex->spname
This is a fragment from sp_create_routine():
The function mysql_create_routine() uses the same style:
In the above code, both LEX::sp_name and sp_sphead point to copies of the same qualified routine name. Copying is done in sql_yacc.yy:
We're going to reuse sp_head to store Oracle-style packages soon (see
To avoid duplicating of this redundancy, we should get rid of it before implementing packages.
Under terms of this task we will:
1. Fix the code responsible for CREATE PROCEDURE and CREATE FUNCTION not to use lex->spname, and to use sphead instead. This includes functions:
2. Remove copying of the routine name to LEX::spname. The latter should stay NULL during CREATE PROCEDURE and CREATE FUNCTION.