[MDEV-30846] LOCK TABLES in BEGIN NOT ATOMIC block causes error Created: 2023-03-14  Updated: 2023-10-04

Status: Open
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.11.2, 10.6
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: David Gausmann Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: 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/


 Comments   
Comment by Sergei Golubchik [ 2023-03-17 ]

thanks. the documentation is now fixed.

Generated at Thu Feb 08 10:19:20 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.