Details
-
New Feature
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
-
None
Description
Background:
MariaDB (including versions 10.x, 11.x, and 12.x) currently supports only
positional parameters when calling stored procedures. For example:
CALL GetPatientData(NULL, 1);
This requires callers to pass arguments strictly in order, even when many of
them are optional or have default values. Unlike SQL Server, PostgreSQL,
Oracle, and other modern RDBMS, MariaDB does not support named parameter
invocation in CALL statements.
Example of desired syntax:
CALL GetPatientData(status => 1);
CALL GetPatientData(p_uhid := 'UH12345');
CALL GetPatientData(p_status => 0, p_uhid => 'ABC001');
This feature would bring MariaDB stored procedure calls in line with modern SQL
standards and significantly improve developer usability.
Benefits of Adding Named Parameter Support:
1. Improves readability and clarity when calling procedures.
2. Allows callers to skip optional parameters without using NULL placeholders.
3. Makes procedure calls self-documenting and reduces errors caused by
parameter-order mismatches.
4. Simplifies migrations from SQL Server, Oracle, PostgreSQL, and other RDBMS
that support named parameters.
5. Enhances usability for procedures with many optional or default parameters.
6. Aligns with modern application frameworks that prefer named argument support.
Current Limitations:
- MariaDB requires positional parameters exclusively.
- Parameters must be passed in strict order.
- Default parameters cannot be selectively overridden without supplying NULLs
for preceding arguments. - Large procedures with many parameters become harder to maintain and call
correctly.
Proposed Enhancement:
- Add support for named parameter syntax using either `=>` or `:=`:
CALL ProcedureName(paramName => value);
CALL ProcedureName(paramName := value);
- Allow mixing positional and named parameters, with the rule that named
parameters must appear after positional parameters (similar to many
programming languages and SQL dialects).
Impact:
Enabling named parameter invocation would greatly improve developer
productivity, reduce errors, and make MariaDB more user-friendly for enterprise
applications. It would also reduce friction for organizations migrating from
MSSQL, PostgreSQL, or Oracle—all of which support named parameter calls.
Thank you for considering this enhancement.