Details
- 
    
New Feature
 - 
    Status: Open (View Workflow)
 - 
    
Critical
 - 
    Resolution: Unresolved
 - 
    None
 
- 
        Q4/2025 Server Development
 
Description
Implement overloading in package functions and procedures, to make it possible to declare routines with the same name but with:
- Different number of arguments
 - The same number of arguments, but with different argument types
 
to make possible declarations like this:
					SET sql_mode=ORACLE;  | 
		
					DELIMITER $$
			 | 
		
					CREATE OR REPLACE PACKAGE pkg1  | 
		
					AS
			 | 
		
					FUNCTION f1() RETURN INT;  | 
		
					FUNCTION f1(a INT) RETURN INT;  | 
		
					FUNCTION f1(a TEXT) RETURN INT;  | 
		
					FUNCTION f1(a INT, b TEXT) RETURN INT;  | 
		
					FUNCTION f1(a TEXT, b INT) RETURN INT;  | 
		
					END;  | 
		
					$$
			 | 
		
Overloading will work in all sql_mode's using their respective syntax.
The scope
This task is only about overloading in package routines.
Overloading in schema routines will be done separately, because it'll need more efforts:
- Changes in mysql.proc.specific_name
 - Changes in INFORMATION_SCHEMA.ROUTINES.SPECIFIC_NAME.
 
These coulumns should return something similar to C++ mangled function names - a combination of the name and the signature for parameters
Relation to MDEV-18951
This task does not duplicate any functionality described in MDEV-18951, which is not about overloading but is rather about template-style functions, similar to C++ templates.
In terms of C++,
- MDEV-18951 is very close to:
template<typename X>
bool lt(const X a, const X b)
{return a < b;
}; - MDEV-34484 is about:
bool lt(const double a, const double b){return a < b;};Â
bool lt(const int b, const int b){return a < b;}; 
Although, both approaches effectively implement the same functionality, they use different instrumentation to achieve it.
Attachments
Issue Links
- blocks
 - 
                    
MDEV-34569 Oracle compatibility project 4
-         
 - Open
 
 -         
 
- relates to
 - 
                    
MDEV-10862 Stored procedures: default values for parameters (optional parameters)
-         
 - Closed
 
 -         
 - 
                    
MDEV-18951 Polymorphic Data Types for Functions
-         
 - Open
 
 -