spring-projects / spring-projects/spring-framework

ScriptUtils#splitSqlScript cannot deal with semicolons in stored procedures [SPR-15438]

Open
#19,999 12 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: data type: enhancement
Dominant language
Java
Stars
60.2k
Forks
38.8k
Avg merge
5d 2h
Merged PRs (30d)
27

Description

Phil Webb opened SPR-15438 and commented

Originally raised with Spring Boot the org.springframework.jdbc.datasource.init.ScriptUtils#splitSqlScript method cannot deal with semicolons that are part of a stored procedure.

For example:

CREATE FUNCTION count_clients() RETURNS integer
    LANGUAGE plpgsql
    AS $$begin
  select count(*) from clients;
end;$$;

Affects: 4.3.7

Issue Links:

  • #19952 Oracle SQL hints are ignored as comments in ScriptUtils

2 votes, 5 watchers

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at org.springframework.jdbc.datasource.init.ScriptUtils#splitSqlScript and trace how the supplied SQL is split. Use the PostgreSQL function example in the issue to check behavior around semicolons inside the stored procedure body. Done means semicolons within the procedure are preserved while the statement is separated correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, sql
Domain
backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.