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] 对Postgresql 的HINT解析支持 #6181

Open
chestertang opened this issue Oct 18, 2024 · 1 comment
Open

[BUG] 对Postgresql 的HINT解析支持 #6181

chestertang opened this issue Oct 18, 2024 · 1 comment

Comments

@chestertang
Copy link

Database Type

postpresql

Database Version

16

Druid Version

1.2.22

JDK Version

openJDK 1.8

Error SQL

PostgreSQL支持使用Hint expand进行性能优化, 使用 druid 解析带 Hint 的 SQL 如下所示:

String = "INSERT INTO  payments(amountNumber) select  /*! no_expand */ sum(amount) from payments";
List<SQLStatement> statements = SQLUtils.parseStatements(sql, DbType.of("postgresql"))

获取 statements 中, 把原SQL语句的 /*! no_expand / Hint 片段 丢失了, 如果把 DbType.of("postgresql") 换成 DbType.of("mysql"), /! no_expand */ Hint 片段不会丢失。

通过查看 druid 源码, 发现 MySqlSelectParser 对 Token.HINT 有相关的处理。 而 PGSelectParser 并没有发现 Token.HINT 的代码处理逻辑。

请问 druid 是否支持 PostgreSQL支持使用Hint ? 如果能支持,请指出问题哪弄错了?

Testcase Code

No response

Stacktrace Info

No response

Error Info

No response

@chestertang chestertang changed the title [BUG] [BUG] 对Postgresql 的HINT解析支持 Oct 18, 2024
@chestertang
Copy link
Author

如果不能支持,能否考虑后续的版本 druid 支持 PostgreSQL支持使用Hint

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