Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
10.5.4
-
None
Description
The commands
DELIMITER // |
|
CREATE PROCEDURE simpleproc (OUT param1 INT)
|
BEGIN
|
SELECT COUNT(*) INTO param1 FROM t;
|
END;
|
//
|
|
DELIMITER ;
|
|
DROP PROCEDURE simpleproc ;
|
will not be logged with
set global server_audit_events = "CONNECT,QUERY_DDL,QUERY_DCL";
also not with QUERY_DML
set global server_audit_events = "CONNECT,QUERY_DDL,QUERY_DCL,QUERY_DML";
with adding QUERY it works.
set global server_audit_events = "CONNECT,QUERY_DDL,QUERY_DCL,QUERY_DML,QUERY";
In the KB CREATE / DROP PROCEDURE will not classified as DDL.
—except CREATE/DROP [PROCEDURE / FUNCTION / USER] and RENAME USER (they're not DDL)
|
[https://mariadb.com/kb/en/mariadb-audit-plugin-log-settings/|
https://mariadb.com/kb/en/mariadb-audit-plugin-log-settings/]
Even if this would be true, it should be logged with adding QUERY_DML at least,
but SQL standard classify it also as DDL.
https://www.w3schools.in/mysql/ddl-dml-dcl/#DDL
In MariaDB and SQL standard DROP / CREATE Procedures is classified as DDL.
I had difficulties parsing the description of the issue, I think eventually I got it, let me re-phrase it the way I understood it:
Problem 1:
The Audit plugin doesn't log CREATE PROCEDURE when audit event types are limited to QUERY_DDL and/or QUERY_DML, it only logs CREATE PROCEDURE when QUERY events are enabled.
Problem 2:
The Audit plugin documentation claims that CREATE PROCEDURE and such are not DDL.
I agree that "problem 2" is a valid complaint. Even if, on whatever reason, the Audit plugin is designed not to count CREATE PROCEDURE as an audit event of type QUERY_DDL, it doesn't mean that "they're not DDL". The KB should be more accurate and say that they are not logged along with other DDL statements, or whatever, and preferably explain why.
For the "problem 1", apparently the Audit plugin works as designed, or at least as documented. The fact that the Audit plugin intentionally doesn't consider CREATE PROCEDURE as QUERY_DDL is explicitly stated in the documentation, even if the wording is clumsy. I cannot determine whether it's a design flaw which needs to be fixed, as I don't know why it was decided to be done this way. Assigning to ralf.gebhardt@mariadb.com, hopefully he knows the reason.
At the same time, this exception by no means implies that it would be considered DML instead, neither does the documentation say so. Regardless of whether it counts as DDL in the Audit plugin world, CREATE PROCEDURE cannot possibly be DML.