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

Fix SQLUtils.splitSqlScript: keep semicolons after END when semicolon is not the statement separator #8108

Merged

Conversation

inponomarev
Copy link
Contributor

This PR continues to stabilize ScriptUtils.splitSqlScript after major rework in #7646 and bug fixes in #7818

Problem

Currently in scripts for Oracle, where / is typically used as a statement separator, top-level BEGIN...END blocks are stripped from the semicolon. But unlike other databases, Oracle requires that semicolon is present, otherwise a syntax error occurs.

InputCurrent (incorrect) outputExpected output
BEGIN
  -- do something
END;
/
BEGIN
   -- do something else
END;
BEGIN
  -- do something
END

BEGIN
   -- do something else
END
BEGIN
  -- do something
END;

BEGIN
   -- do something else
END;

This behaviour occurs because of a misplaced line of code

This PR does not change the original behaviour of "recognizing" top-level BEGIN...END blocks when a specific statement separator is not set, i. e.

InputCurrent (correct) output
BEGIN
  -- do something
END;

BEGIN
   -- do something else
END;
BEGIN
  -- do something
END

BEGIN
   -- do something else
END

@inponomarev inponomarev requested a review from a team as a code owner January 12, 2024 13:00
@eddumelendez eddumelendez added this to the next milestone Jan 15, 2024
@eddumelendez eddumelendez merged commit 4ff8d1d into testcontainers:main Jan 15, 2024
88 checks passed
@eddumelendez
Copy link
Member

Thanks again for your contribution, @inponomarev !

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

Successfully merging this pull request may close these issues.

None yet

2 participants