MDEV-38329: Named Parameters in Invocation of Stored Routines#4681
Draft
rajatmohan22 wants to merge 3 commits intoMariaDB:mainfrom
Draft
MDEV-38329: Named Parameters in Invocation of Stored Routines#4681rajatmohan22 wants to merge 3 commits intoMariaDB:mainfrom
rajatmohan22 wants to merge 3 commits intoMariaDB:mainfrom
Conversation
Author
|
I’ve pushed the initial groundwork for MDEV-38329 (introducing the Call_param structure in LEX and wiring it into call_statement_start(), no functional changes yet). I’m currently continuing to research the execution and binding flow carefully before moving to the next step. I’d really appreciate your feedback when you have a moment and your help in keeping tabs on this PR so I stay aligned with the intended direction. Thank you very much. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MDEV-38329: Named Parameters in Invocation of Stored Routines
Description
This a draft PR begins implimentation of support for named parameters in stored routine invocation, for ex:
Current State
right now
CALLarguments are parsed strictly as positional expressions -CALL→opt_sp_cparam_list→sp_cparamsexprLex->value_listsp_head::execute_procedure()is strictly positionalThere is no syntax of argument names and no name-based resolution. This PR starts adding support for
ident => exprsyntax.Current Commit (WIP)
Commit 1: Introduce CALL parameter structure
Adds a Call_param structure in LEX:
LEX_CSTRING name
Item *value
Adds
List<Call_param> call_param_listClears call_param_list in call_statement_start()
No functional changes yet.
Parser and binding logic remain unchanged.
This commit prepares the LEX layer to store named arguments in addition to positional ones.
Planned Implementation Steps
The remaining work to follow in additional commits in this PR:
1. Extend grammar in
sql/sql_yacc.yyto allow bothexprandident => exprinside routine argument lists.2. Represent
CALLarguments as structured entries instead of rawItem*only, e.g.{ name, Item* }wherenameis empty for positional arguments.3. Add a resolution step before calling
sp_head::execute_procedure(thd, &args). This step will:sp_pcontext/sp_variable4. Add MTR tests covering procedures, stored functions, mixed positional + named usage, and error cases.
Design Direction
Resolution will occur before invoking
execute_procedure()so that the existing positional binding logic —adjust_formal_params_to_actual_params()andbind_input_param()— can remain largely unchanged.