Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] SQLSelect.getQueryBlock() 不支持 SQLUnionQuery #6217

Open
remind opened this issue Nov 6, 2024 · 1 comment
Open

[BUG] SQLSelect.getQueryBlock() 不支持 SQLUnionQuery #6217

remind opened this issue Nov 6, 2024 · 1 comment

Comments

@remind
Copy link

remind commented Nov 6, 2024

Database Type

ALL

Database Version

ALL

Druid Version

ALL

JDK Version

ALL

Error SQL

SELECT id, name FROM table_multi_executor_test WHERE (id) in ( (?) ) UNION SELECT id, name FROM table_multi_executor_test WHERE (id) in ( (?) )

Testcase Code

SQLSelectStatement ast = (SQLSelectStatement) asts.get(0);
SQLSelectQueryBlock queryBlock = ast.getSelect().getQueryBlock();

Stacktrace Info

No response

Error Info

image

在修改seata的一个问题 apache/incubator-seata#6957 时发现在调用druid中的com.alibaba.druid.sql.ast.statement.SQLSelect#getQueryBlock方法获取表信息时
image
发现该方法没有针对SQLUnionQuery做处理,如果查询语句中有union就会是SQLUnionQuery,可以取getFirstQueryBlock()获取到SQLSelectQueryBlock

请问是出于什么考虑没这样做,还是忘了处理,能否判断一下SQLUnionQuery,取getFirstQueryBlock()

@remind remind changed the title [BUG] SQLSelect.getQueryBlock() unsupport SQLUnionQuery [BUG] SQLSelect.getQueryBlock() 不支持 SQLUnionQuery Nov 6, 2024
@remind
Copy link
Author

remind commented Nov 6, 2024

image 已经存在该方法,该issue关闭

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

No branches or pull requests

1 participant