Skip to content

Postgres stored procedures not executing #2903

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

Closed
Jolymmiles opened this issue Apr 5, 2023 · 7 comments
Closed

Postgres stored procedures not executing #2903

Jolymmiles opened this issue Apr 5, 2023 · 7 comments
Assignees
Labels
type: task A general task

Comments

@Jolymmiles
Copy link

Jolymmiles commented Apr 5, 2023

Get errors when start stored procedure

@Repository

public interface Repo extends CrudRepository<EntityClass, String> {
    @Procedure(procedureName = "sp_dis_hierarchy_sync_groups")
    void sync();
}

image
image

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 5, 2023
@gregturn
Copy link
Contributor

gregturn commented May 1, 2023

Looks like something fundamental has changed regarding stored procedures in Postgres 11+. Our current integration tests use Postgres 10, and run just fine. Back then, stored procedures were simply functions with a void return type.

Apparently, this has changed massively, and considering we simply later over JPA regarding stored procedure invocations, I'm trying to glean where the real issue is.

@gregturn
Copy link
Contributor

gregturn commented May 5, 2023

@Jolymmiles What version of Postgres are you using?

@gregturn gregturn added the status: waiting-for-feedback We need additional information before we can continue label May 5, 2023
@spring-projects-issues
Copy link

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@spring-projects-issues spring-projects-issues added the status: feedback-reminder We've sent a reminder that we need additional information before we can continue label May 12, 2023
@spring-projects-issues
Copy link

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

@spring-projects-issues spring-projects-issues closed this as not planned Won't fix, can't repro, duplicate, stale May 19, 2023
@spring-projects-issues spring-projects-issues removed status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged labels May 19, 2023
@gregturn gregturn reopened this May 19, 2023
@gregturn
Copy link
Contributor

We know that this involves Postgres 11+.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 19, 2023
@gregturn gregturn added type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged labels May 30, 2023
gregturn added a commit that referenced this issue May 30, 2023
Postgres stored procedures requires some adjustments in order to upgrade to Postgres 11.

See #2903
gregturn added a commit that referenced this issue May 30, 2023
Postgres stored procedures requires some adjustments in order to upgrade to Postgres 11.

See #2903
gregturn added a commit that referenced this issue May 30, 2023
Postgres stored procedures requires some adjustments in order to upgrade to Postgres 11.

See #2903
@gregturn
Copy link
Contributor

Because Postgres didn't have proper stored procedures in versions 10 and earlier, we had integration testing using that combined with that. However, with Postgres 11+, there is now proper support through JPA/Hibernate, etc.

For stored procedures to work properly for you you can either:

  • Upgraded your Postgres procedures from functions to procedures properly
  • Instead of using @Procedure, switch to @Query and use select statement statements against the stored functions.

gregturn added a commit that referenced this issue May 30, 2023
Postgres stored procedures requires some adjustments in order to upgrade to Postgres 11.

See #2903
@gregturn
Copy link
Contributor

Tests updated for main, 3.1.x, and 3.0.x. Checked out 2.7.x, but Hibernate 5.x is still on Postgres 9, so not applicable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task A general task
Projects
None yet
Development

No branches or pull requests

3 participants