I'm trying to use Spring JDBC Template to call a stored procedure inside a postgres database. The connection is done from the yaml configuration file to indicate the current schema to use:
jdbc:postgresql://localhost:5455/userdb?currentSchema=customschema
Every queries done directly from jdbc template is using the correct current schema "customschema". However, only executions done from SimpleJdbcCall to call a stored procedure is done in postgres default schema which is "public", and I can't understand why.
Here is the execution code:
new SimpleJdbcCall(jdbcTemplate).withFunctionName("custom_stored_procedure_name").execute();
While debugging, if I look at that jdbcTemplate.getDataSource().getConnection().getSchema()
, it returns the correct schema which is "customschema".
I need to force the schema with .withSchemaName("customschema")
for this execution to work with the correct schema instead of "public".
I can't find any documentation online regarding this behavior.
Is it an issue from the library itself ?
为每个调用指定架构或将架构添加到搜索路径。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.