Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
Description
The following keywords have a very different meaning in the default sql_mode and in sql_mode=ORACLE.
- BEGIN
- BODY
- CONTINUE
- ELSIF
- EXCEPTION
- EXIT
- GOTO
- OTHERS
- PACKAGE
- RAISE
- RETURN
- ROWTYPE
To unify sql_yacc.yy and sql_yacc_ora.yy easier, we'll add sql_mode specific tokens for these keywords and modify the grammar in sql_yacc.yy and sql_yacc_ora.yy accordingly.
So for example, instead of BEGIN_SYM, we'll have separate BEGIN_MARIADB_SYM and BEGIN_ORACLE_SYM.
This will make it possible for native and Oracle grammar rules to co-exists in the same *.yy files.
By default, Lex_input_stream::find_keyword() will return the _MARIADB_SYM versions of the keywords, and translate them to _ORACLE_SYM on Oracle compatibility mode, e.g. like this:
if (m_thd->variables.sql_mode & MODE_ORACLE) |
{
|
switch (symbol->tok) { |
case BEGIN_MARIADB_SYM: return BEGIN_ORACLE_SYM; |
case BODY_MARIADB_SYM: return BODY_ORACLE_SYM; |
case CONTINUE_MARIADB_SYM: return CONTINUE_ORACLE_SYM; |
case ELSIF_MARIADB_SYM: return ELSIF_ORACLE_SYM; |
case EXCEPTION_MARIADB_SYM: return EXCEPTION_ORACLE_SYM; |
case EXIT_MARIADB_SYM: return EXIT_ORACLE_SYM; |
case GOTO_MARIADB_SYM: return GOTO_ORACLE_SYM; |
case OTHERS_MARIADB_SYM: return OTHERS_ORACLE_SYM; |
case PACKAGE_MARIADB_SYM: return PACKAGE_ORACLE_SYM; |
case RAISE_MARIADB_SYM: return RAISE_ORACLE_SYM; |
case RETURN_MARIADB_SYM: return RETURN_ORACLE_SYM; |
case ROWTYPE_MARIADB_SYM: return ROWTYPE_ORACLE_SYM; |
}
|
}
|
Attachments
Issue Links
- blocks
-
MDEV-12518 Unify sql_yacc.yy and sql_yacc_ora.yy
- Closed
- relates to
-
MDEV-17661 Add sql_mode specific tokens for the keyword DECODE
- Closed
-
MDEV-17664 Add sql_mode specific tokens for ':' and '%'
- Closed