Skip to content

fix feature-service bug#1581

Open
yu-han-yang wants to merge 1 commit into
WebFuzzing:masterfrom
yu-han-yang:yyh_sql_debug
Open

fix feature-service bug#1581
yu-han-yang wants to merge 1 commit into
WebFuzzing:masterfrom
yu-han-yang:yyh_sql_debug

Conversation

@yu-han-yang

Copy link
Copy Markdown

No description provided.

@yu-han-yang

Copy link
Copy Markdown
Author

@man-zhang

@yu-han-yang yu-han-yang reopened this Jun 12, 2026
@man-zhang man-zhang reopened this Jun 12, 2026
@man-zhang man-zhang requested review from Copilot and man-zhang and removed request for Copilot June 12, 2026 03:55
@yu-han-yang yu-han-yang changed the title 修复feature-service涉及到的bug fix feature-service bug Jun 12, 2026
@whytomato

whytomato commented Jun 12, 2026

Copy link
Copy Markdown

Problem

SqlNameContext could not correctly process aliases assigned to parenthesized subqueries, particularly when the subquery contained a set operation such as UNION ALL.

For example:

SELECT derived.id
FROM (
    SELECT id FROM constraint_requires
    UNION ALL
    SELECT id FROM constraint_excludes
) derived
WHERE derived.id = 2

The previous implementation called ParenthesedSelect#getPlainSelect(). However, a UNION query is represented by a SetOperationList, so getPlainSelect() can return null, resulting in a NullPointerException.

The alias was also read from the inner FROM item, although derived belongs to the enclosing ParenthesedSelect.

Fix

The alias is now read directly from the ParenthesedSelect.

Parenthesized subqueries are represented as UNNAMED_TABLE, and their aliases are mapped to that value. This avoids incorrectly assuming that every parenthesized SELECT contains a PlainSelect and allows qualified columns such as derived.id to be resolved correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants