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] 表达式tostring报错了 com.alibaba.druid.sql.visitor.SQLASTOutputVisitor cannot be cast to com.alibaba.druid.sql.dialect.postgresql.visitor.PGASTVisitor #6292

Open
lanyanhua opened this issue Dec 17, 2024 · 1 comment

Comments

@lanyanhua
Copy link

Database Type

postgres

Database Version

42.7.3

Druid Version

42.7.3

JDK Version

1.2.15

Error SQL

EXTRACT (DAY FROM current_date - queryopendate) > 14
AND querystatus = '打开质疑'

Testcase Code

SQLUtils.toSQLExpr("CASE WHEN EXTRACT (DAY FROM current_date - queryopendate) > 14 AND querystatus = '打开质疑' THEN 1 ELSE 0 END"
, DbType.postgresql);

Stacktrace Info

No response

Error Info

No response

@lanyanhua
Copy link
Author

已解决 ,别使用 expr.tostring()。里面dbType 是用的null。指定dbType转string
SQLUtils.toSQLString(expr, dbType)

@lanyanhua lanyanhua changed the title [BUG] 表达式tostring报错了 [BUG] 表达式tostring报错了 com.alibaba.druid.sql.visitor.SQLASTOutputVisitor cannot be cast to com.alibaba.druid.sql.dialect.postgresql.visitor.PGASTVisitor Dec 17, 2024
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