Details
-
Technical task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.3(EOL)
-
10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-4, 10.1.18
Description
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():
if (!(table= open_proc_table_for_update(thd))) |
{
|
my_error(ER_SP_STORE_FAILED, MYF(0), SP_TYPE_STRING(type),sp->m_name.str)
|
goto done; |
}
|
else |
{
|
/* Checking if the routine already exists */ |
if (db_find_routine_aux(thd, type, lex->spname, table) == SP_OK) |
{
|
The function mysql_create_routine() uses the same style:
if (check_db_name((LEX_STRING*) &lex->sphead->m_db)) |
{
|
...
|
if (lex->create_info.or_replace()) |
{
|
if (check_routine_access(thd, ALTER_PROC_ACL, lex->spname->m_db.str, |
...
|
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:
if (!Lex->make_sp_head_no_recursive(thd, $1, $2, |
TYPE_ENUM_FUNCTION))
|
MYSQL_YYABORT;
|
Lex->spname= $2;
|
We're going to reuse sp_head to store Oracle-style packages soon (see MDEV-10591).
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:
- mysql_create_routine()
- sp_create_routine()
2. Remove copying of the routine name to LEX::spname. The latter should stay NULL during CREATE PROCEDURE and CREATE FUNCTION.
Attachments
Issue Links
- blocks
-
MDEV-10591 Oracle-style packages
-
- Closed
-
Activity
Field | Original Value | New Value |
---|---|---|
Link |
This issue blocks |
Description |
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()}}: {code:cpp} if (!(table= open_proc_table_for_update(thd))) { my_error(ER_SP_STORE_FAILED, MYF(0), SP_TYPE_STRING(type),sp->m_name.str); -- Via {{sp_head}} goto done; } else { /* Checking if the routine already exists */ if (db_find_routine_aux(thd, type, lex->spname, table) == SP_OK) -- Via {{LEX}} { {cpp} The function {{mysql_create_routine()}} uses the same style: {code:cpp} if (check_db_name((LEX_STRING*) &lex->sphead->m_db)) -- Via {{sp_head}} { ... if (check_access(thd, CREATE_PROC_ACL, lex->sphead->m_db.str, -- Via {{LEX}} NULL, NULL, 0, 0)) ... {code} 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: {code:cpp} if (!Lex->make_sp_head_no_recursive(thd, $1, $2, TYPE_ENUM_FUNCTION)) MYSQL_YYABORT; Lex->spname= $2; {code} 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: - {{mysql_create_routine()}} - {{sp_create_routine()}} 2. Remove copying of the routine name to {{LEX::spname}}. The latter should stay {{NULL}} during {{CREATE PROCEDURE}} and {{CREATE FUNCTION}}. |
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()}}: {code:cpp} if (!(table= open_proc_table_for_update(thd))) { my_error(ER_SP_STORE_FAILED, MYF(0), SP_TYPE_STRING(type),sp->m_name.str); -- Via {{sp_head}} goto done; } else { /* Checking if the routine already exists */ if (db_find_routine_aux(thd, type, lex->spname, table) == SP_OK) -- Via {{LEX}} { {code} The function {{mysql_create_routine()}} uses the same style: {code:cpp} if (check_db_name((LEX_STRING*) &lex->sphead->m_db)) -- Via {{sp_head}} { ... if (check_access(thd, CREATE_PROC_ACL, lex->sphead->m_db.str, -- Via {{LEX}} NULL, NULL, 0, 0)) ... {code} 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: {code:cpp} if (!Lex->make_sp_head_no_recursive(thd, $1, $2, TYPE_ENUM_FUNCTION)) MYSQL_YYABORT; Lex->spname= $2; {code} 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: - {{mysql_create_routine()}} - {{sp_create_routine()}} 2. Remove copying of the routine name to {{LEX::spname}}. The latter should stay {{NULL}} during {{CREATE PROCEDURE}} and {{CREATE FUNCTION}}. |
Description |
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()}}: {code:cpp} if (!(table= open_proc_table_for_update(thd))) { my_error(ER_SP_STORE_FAILED, MYF(0), SP_TYPE_STRING(type),sp->m_name.str); -- Via {{sp_head}} goto done; } else { /* Checking if the routine already exists */ if (db_find_routine_aux(thd, type, lex->spname, table) == SP_OK) -- Via {{LEX}} { {code} The function {{mysql_create_routine()}} uses the same style: {code:cpp} if (check_db_name((LEX_STRING*) &lex->sphead->m_db)) -- Via {{sp_head}} { ... if (check_access(thd, CREATE_PROC_ACL, lex->sphead->m_db.str, -- Via {{LEX}} NULL, NULL, 0, 0)) ... {code} 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: {code:cpp} if (!Lex->make_sp_head_no_recursive(thd, $1, $2, TYPE_ENUM_FUNCTION)) MYSQL_YYABORT; Lex->spname= $2; {code} 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: - {{mysql_create_routine()}} - {{sp_create_routine()}} 2. Remove copying of the routine name to {{LEX::spname}}. The latter should stay {{NULL}} during {{CREATE PROCEDURE}} and {{CREATE FUNCTION}}. |
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()}}: {code:cpp} if (!(table= open_proc_table_for_update(thd))) { my_error(ER_SP_STORE_FAILED, MYF(0), SP_TYPE_STRING(type),sp->m_name.str) goto done; } else { /* Checking if the routine already exists */ if (db_find_routine_aux(thd, type, lex->spname, table) == SP_OK) { {code} The function {{mysql_create_routine()}} uses the same style: {code:cpp} if (check_db_name((LEX_STRING*) &lex->sphead->m_db)) { ... if (check_access(thd, CREATE_PROC_ACL, lex->sphead->m_db.str, NULL, NULL, 0, 0)) ... {code} 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: {code:cpp} if (!Lex->make_sp_head_no_recursive(thd, $1, $2, TYPE_ENUM_FUNCTION)) MYSQL_YYABORT; Lex->spname= $2; {code} 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: - {{mysql_create_routine()}} - {{sp_create_routine()}} 2. Remove copying of the routine name to {{LEX::spname}}. The latter should stay {{NULL}} during {{CREATE PROCEDURE}} and {{CREATE FUNCTION}}. |
Description |
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()}}: {code:cpp} if (!(table= open_proc_table_for_update(thd))) { my_error(ER_SP_STORE_FAILED, MYF(0), SP_TYPE_STRING(type),sp->m_name.str) goto done; } else { /* Checking if the routine already exists */ if (db_find_routine_aux(thd, type, lex->spname, table) == SP_OK) { {code} The function {{mysql_create_routine()}} uses the same style: {code:cpp} if (check_db_name((LEX_STRING*) &lex->sphead->m_db)) { ... if (check_access(thd, CREATE_PROC_ACL, lex->sphead->m_db.str, NULL, NULL, 0, 0)) ... {code} 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: {code:cpp} if (!Lex->make_sp_head_no_recursive(thd, $1, $2, TYPE_ENUM_FUNCTION)) MYSQL_YYABORT; Lex->spname= $2; {code} 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: - {{mysql_create_routine()}} - {{sp_create_routine()}} 2. Remove copying of the routine name to {{LEX::spname}}. The latter should stay {{NULL}} during {{CREATE PROCEDURE}} and {{CREATE FUNCTION}}. |
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()}}: {code:cpp} if (!(table= open_proc_table_for_update(thd))) { my_error(ER_SP_STORE_FAILED, MYF(0), SP_TYPE_STRING(type),sp->m_name.str) goto done; } else { /* Checking if the routine already exists */ if (db_find_routine_aux(thd, type, lex->spname, table) == SP_OK) { {code} The function {{mysql_create_routine()}} uses the same style: {code:cpp} if (check_db_name((LEX_STRING*) &lex->sphead->m_db)) { ... if (lex->create_info.or_replace()) { if (check_routine_access(thd, ALTER_PROC_ACL, lex->spname->m_db.str, ... {code} 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: {code:cpp} if (!Lex->make_sp_head_no_recursive(thd, $1, $2, TYPE_ENUM_FUNCTION)) MYSQL_YYABORT; Lex->spname= $2; {code} 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: - {{mysql_create_routine()}} - {{sp_create_routine()}} 2. Remove copying of the routine name to {{LEX::spname}}. The latter should stay {{NULL}} during {{CREATE PROCEDURE}} and {{CREATE FUNCTION}}. |
Description |
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()}}: {code:cpp} if (!(table= open_proc_table_for_update(thd))) { my_error(ER_SP_STORE_FAILED, MYF(0), SP_TYPE_STRING(type),sp->m_name.str) goto done; } else { /* Checking if the routine already exists */ if (db_find_routine_aux(thd, type, lex->spname, table) == SP_OK) { {code} The function {{mysql_create_routine()}} uses the same style: {code:cpp} if (check_db_name((LEX_STRING*) &lex->sphead->m_db)) { ... if (lex->create_info.or_replace()) { if (check_routine_access(thd, ALTER_PROC_ACL, lex->spname->m_db.str, ... {code} 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: {code:cpp} if (!Lex->make_sp_head_no_recursive(thd, $1, $2, TYPE_ENUM_FUNCTION)) MYSQL_YYABORT; Lex->spname= $2; {code} 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: - {{mysql_create_routine()}} - {{sp_create_routine()}} 2. Remove copying of the routine name to {{LEX::spname}}. The latter should stay {{NULL}} during {{CREATE PROCEDURE}} and {{CREATE FUNCTION}}. |
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()}}: {code:cpp} if (!(table= open_proc_table_for_update(thd))) { my_error(ER_SP_STORE_FAILED, MYF(0), SP_TYPE_STRING(type),sp->m_name.str) goto done; } else { /* Checking if the routine already exists */ if (db_find_routine_aux(thd, type, lex->spname, table) == SP_OK) { {code} The function {{mysql_create_routine()}} uses the same style: {code:cpp} if (check_db_name((LEX_STRING*) &lex->sphead->m_db)) { ... if (lex->create_info.or_replace()) { if (check_routine_access(thd, ALTER_PROC_ACL, lex->spname->m_db.str, ... {code} 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: {code:cpp} if (!Lex->make_sp_head_no_recursive(thd, $1, $2, TYPE_ENUM_FUNCTION)) MYSQL_YYABORT; Lex->spname= $2; {code} 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: - {{mysql_create_routine()}} - {{sp_create_routine()}} 2. Remove copying of the routine name to {{LEX::spname}}. The latter should stay {{NULL}} during {{CREATE PROCEDURE}} and {{CREATE FUNCTION}}. |
Status | Open [ 1 ] | In Progress [ 3 ] |
issue.field.resolutiondate | 2017-07-12 18:55:47.0 | 2017-07-12 18:55:47.707 |
Fix Version/s | 10.3.1 [ 22532 ] | |
Fix Version/s | 10.3 [ 22126 ] | |
Resolution | Fixed [ 1 ] | |
Status | In Progress [ 3 ] | Closed [ 6 ] |
Workflow | MariaDB v3 [ 81647 ] | MariaDB v4 [ 152470 ] |