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

set var=DEFAULT validates values too late

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.6, 10.11, 11.4, 10.5(EOL), 11.8
    • 10.11, 11.4, 11.8
    • Variables
    • None

    Description

      Normally SET works in two steps, first all variables validate the values, if that fails, SET is aborted. Then new values get assigned to variables, and this is expected always to succeed.

      But the normal validation step isn't run when assigning a DEFAULT value to a variable. The validation is done during the second, update, step, unexpectedly aborting it in the middle.

      For example:

      start transaction;
      set @a='did not change';
      select @a;
      --error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SQL_LOG_BIN
      set @a='changed', sql_log_bin=1; select @a;
      --error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SQL_LOG_BIN
      set @a='changed', sql_log_bin=0; select @a;
      --error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SQL_LOG_BIN
      set @a='changed', sql_log_bin=default; select @a;
      

      The output being

      start transaction;
      set @a='did not change';
      select @a;
      @a
      did not change
      set @a='changed', sql_log_bin=1;
      ERROR HY000: Cannot modify @@session.sql_log_bin inside a transaction
      select @a;
      @a
      did not change
      set @a='changed', sql_log_bin=0;
      ERROR HY000: Cannot modify @@session.sql_log_bin inside a transaction
      select @a;
      @a
      did not change
      set @a='changed', sql_log_bin=default;
      ERROR HY000: Cannot modify @@session.sql_log_bin inside a transaction
      select @a;
      @a
      changed
      

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              serg Sergei Golubchik
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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