You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "014-code (via GitHub)" <gi...@apache.org> on 2026/06/09 13:07:40 UTC

[PR] Fix MySQL user variable handling in Proxy SET statements [shardingsphere]

014-code opened a new pull request, #38835:
URL: https://github.com/apache/shardingsphere/pull/38835

   ### What changed
   
   - Skip MySQL system variable validation for user variables such as `@test_var`.
   - Add a unit test to verify `SET @test_var = 1` is recorded as a replayable session variable.
   
   ### Why
   
   MySQL user variables are valid session-scoped variables, but ShardingSphere Proxy validated every non-global SET variable through the MySQL system variable registry. This caused `SET @test_var = 1` to fail with `Unknown system variable '@test_var'`.
   
   ### Verification
   
   - Manually verified through ShardingSphere Proxy with MySQL protocol:
     - `SET @test_var = 1;` executes successfully.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix MySQL user variable handling in Proxy SET statements [shardingsphere]

Posted by "014-code (via GitHub)" <gi...@apache.org>.
014-code commented on PR #38835:
URL: https://github.com/apache/shardingsphere/pull/38835#issuecomment-4741282539

   Thanks for the detailed review.
   
   I have updated the implementation to preserve the variable semantics in the parsed statement model instead of inferring them from the rendered variable name.
   
   Changes made:
   - Added VariableType to VariableSegment, with SYSTEM as the default type.
   - Updated the MySQL SET visitor to mark user variables as USER and internal variable names as INTERNAL.
   - Updated MySQLSetVariableAdminExecutor to skip system-variable validation based on VariableType.USER instead of startsWith("@").
   - Added regression coverage for SET @test_var = 1 and SET @test_var := 1.
   - Kept coverage for unknown SESSION variables and valid GLOBAL variables.
   
   Verification:
   - MySQLSetVariableAdminExecutorTest passed.
   - Spotless passed.
   - Checkstyle passed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix MySQL user variable handling in Proxy SET statements [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu merged PR #38835:
URL: https://github.com/apache/shardingsphere/pull/38835


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org