fix: use proper MySQL error for scalar subquery returning multiple rows#25373
Open
aunjgr wants to merge 1 commit into
Open
fix: use proper MySQL error for scalar subquery returning multiple rows#25373aunjgr wants to merge 1 commit into
aunjgr wants to merge 1 commit into
Conversation
Replace NewInternalError with NewErrSubqueryNo1Row which uses ER_SUBQUERY_NO_1_ROW (1242, SQLSTATE 21000), matching MySQL behavior. 9 locations in hashjoin and loopjoin operators. Co-Authored-By: Claude <noreply@anthropic.com>
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
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.
What type of PR is this?
Which issue(s) this PR fixes:
issue #23062
What this PR does / why we need it:
Scalar subquery returning multiple rows used
internal error:prefix (wrong error class). MySQL usesER_SUBQUERY_NO_1_ROW(1242, SQLSTATE 21000).Fix
ErrSubqueryNo1RowinerrorMsgRefermap with proper error code (1242) and SQLSTATE (21000)NewErrSubqueryNo1RowhelperNewInternalErrorcalls in hashjoin (7) and loopjoin (2)Error message retained the "scalar" qualifier for clarity:
ERROR 1242 (21000): scalar subquery returns more than 1 rowpkg/common/moerr/error.gopkg/sql/colexec/hashjoin/join.gopkg/sql/colexec/loopjoin/join.gotest/.../cte.resulttest/.../seq_func2.resulttest/.../subquery-with-in.result🤖 Generated with Claude Code