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

START TRANSACTION IF NOT EXISTS

    XMLWordPrintable

Details

    • Task
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • None
    • None

    Description

      SHORT VERSION: Could we have a START TRANSACTION IF EXISTS that does not commit existing transaction?

      –

      LONG VERSION:

      Sometimes, when a procedure is called, there are possible 2 cases:
      1) The procedure has been called by a trigger: I want to continue the active transaction.
      2) Called by the cli, I want to be sure that a transaction exists.

      But START TRANSACTION commits existing transaction. A snippet like this does NOT solve the problem:

      IF NOT @@in_transaction THEN
      		SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
      		START TRANSACTION;
      END IF;

      Because, if the procedure is called by a trigger, I get:
      ERROR 1422 (HY000): Explicit or implicit commit is not allowed in stored function or trigger.

      START TRANSACTION IF EXISTS would solve the problem.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              f_razzoli Federico Razzoli
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.