Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-17652

Add sql_mode specific tokens for some keywords

    XMLWordPrintable

Details

    • Task
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.3.11
    • Parser
    • 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

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.