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

2.4.3修改为Postgresql数据库后,更新配置报错 #12786

Open
Touketsu-jie opened this issue Oct 27, 2024 · 4 comments
Open

2.4.3修改为Postgresql数据库后,更新配置报错 #12786

Touketsu-jie opened this issue Oct 27, 2024 · 4 comments

Comments

@Touketsu-jie
Copy link

版本:2.4.3
使用Postgresql数据库、启动正常,更新配置时报错:

commands ignored until end of transaction block;nested exception is org.postgresql.util.PSQLException: ERROR: current transaction is aborted,
commands ignored until end of transaction block;caused: ERROR: current transaction is aborted,
commands ignored until end of transaction block;caused: ERROR: function now(integer)does not exist Hint: No function matches the given name and argument types.You might need to add explicit type casts.Position: 81;

@KomachiSion
Copy link
Collaborator

看起来异常都是由PG抛出的, 可能需要排查下PG是不是有什么问题,

另外是否有更多的相关错误日志?

@Touketsu-jie
Copy link
Author

根据官方指导,https://nacos.io/blog/faq/nacos-user-question-history11756/ , 导入了Pg支持插件(https://github.com/nacos-group/nacos-plugin)

com.alibaba.nacos.plugin.datasource.mapper.ConfigInfoMapper.updateConfigInfoAtomicCas 方法中:
String sql = "UPDATE config_info SET " + "content=?, md5=?, src_ip=?, src_user=?, gmt_modified="
+ getFunction("NOW()")
+ ", app_name=?, c_desc=?, c_use=?, effect=?, type=?, c_schema=?, encrypted_data_key=? "
+ "WHERE data_id=? AND group_id=? AND tenant_id=? AND (md5=? OR md5 IS NULL OR md5='')";

在进行配置更新时,getFunction("NOW()")返回的是 NOW(3), 当数据库为Postgresql时更新即会发生错误。

Pg支持插件中没有对getFunction 的重写,返回的仍然是Mysql的NOW(3),导致更新错误。
请问是否有相适配的Pg插件?

@KomachiSion
Copy link
Collaborator

如果最新插件版本中缺少这个方法的适配, 那么就需要在新插件版本中适配一下

@bes2008
Copy link

bes2008 commented Nov 6, 2024

可以尝试使用 https://github.com/bes2008/nacos-plugins

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

No branches or pull requests

3 participants