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

PostgresCallMetaDataProvider should detect current schema as indicated by the JDBC Connection #28723

Closed
hyukchan opened this issue Jun 28, 2022 · 0 comments
Assignees
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Milestone

Comments

@hyukchan
Copy link

hyukchan commented Jun 28, 2022

Hi,

I have issues trying to call a stored procedure using postgresql database through a SimpleJdbcCall.

I set the current schema to use with the parameter currentSchema inside jdbcUrl parameter like this:

jdbc:postgresql://localhost:5455/userdb?currentSchema=customschema

"Standard" queries such as jdbcTemplate.query(...) use the correct schema which is customschema.

Though when I try to call a stored procedure through SimpleJdbcCall, it uses the default postgres schema public.

new SimpleJdbcCall(jdbcTemplate).withFunctionName("custom_stored_procedure_name").execute();

I know I can force the use of customschema on each call with .withSchemaName("customschema"), but I shouldn't need to do this.

While debugging, if I look at jdbcTemplate.getDataSource().getConnection().getSchema(), it returns the correct schema which is "customschema".

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jun 28, 2022
@rwinch rwinch transferred this issue from spring-projects/spring-data-relational Jun 28, 2022
@sbrannen sbrannen added the in: data Issues in data modules (jdbc, orm, oxm, tx) label Jul 1, 2022
@jhoeller jhoeller added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Nov 24, 2023
@jhoeller jhoeller self-assigned this Nov 24, 2023
@jhoeller jhoeller added this to the 6.1.2 milestone Nov 24, 2023
@jhoeller jhoeller changed the title Wrong schema used when calling a stored procedure through SimpleJdbcCall SimpleJdbcCall should detect current schema as indicated by the JDBC Connection Nov 24, 2023
@jhoeller jhoeller changed the title SimpleJdbcCall should detect current schema as indicated by the JDBC Connection PostgresCallMetaDataProvider should detect current schema as indicated by the JDBC Connection Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants