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

LOCK TABLES in BEGIN NOT ATOMIC block causes error

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 10.11.2, 10.6
    • None
    • None
    • None

    Description

      Executing the following SQL code (no transaction, SQL code passed via ODBC as single ADO.Execute statement):

      BEGIN NOT ATOMIC
        LOCK TABLES MyTable WRITE;
        INSERT INTO MyTable (name) VALUES ('test');
        UNLOCK TABLES;
      END
      

      I get this error:

      Microsoft OLE DB Provider for ODBC Drivers: [ma-3.1.17][10.11.2-MariaDB]LOCK is not allowed in stored procedures
      

      There are some issues:

      1. I am not using any stored procedure. So there should be no reason to disallow this. If this is also disallowed in BEGIN/END blocks, then the error message is wrong.
      2. The official MariaDB documentation says "LOCK TABLES can not be used in stored routines - if you try, the following error will be produced on creation. This restriction was removed in MariaDB 10.6.2". My MariaDB version is newer than 10.6.2 but I still got this restriction. Is this a bug? Or is the documentation wrong? See: https://mariadb.com/kb/en/lock-tables/

      Attachments

        Activity

          People

            Unassigned Unassigned
            DaGaMx David Gausmann
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.