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

Oracle SQL hints are ignored as comments in ScriptUtils [SPR-15389] #19952

Open
spring-projects-issues opened this issue Jun 7, 2016 · 0 comments
Labels
in: data type: enhancement

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Jun 7, 2016

Oded Shopen opened SPR-15389 and commented

ScriptUtils executeSqlScript() method has a default comment delimiter of /* and */.

This markers are used by Oracle for hints. For example:

SELECT /*+ DRIVING_SITE (BA) leading (BA S SR) FULL(BA) PARALLEL(BA 4) PARALLEL(S 4) PARALLEL(SR 4) */ BA.CUSTOMER FROM.....

These hints, when added, are crucial for db performance in production. We recently noticed in a production environment that these hints in an SQL file executed by ScriptUtils was ignored. After looking at the code, we saw that the hints were simply removed.

We solved this issue by calling the overloaded executeSqlScript method that takes specific delimiters, and used "fake" delimiters (##/* and */##) in order to get the hints working again. However, I feel this should not be the correct approach as default.

Suggestions would be:

  • Implement a different behavior based on the JDBC driver being used: In case of Oracle, don't ignore these "comments".

  • Alternatively, Take into account the full /*+ marker as not being a comment (although that might not be a solution for all Oracle hints).


Reference URL: http://stackoverflow.com/questions/33144628/springs-scriptutils-ignores-code-containing-comments-in-dump

Issue Links:

  • #17809 Support single quotes nested in double quotes in SQL scripts
  • #19999 org.springframework.jdbc.datasource.init.ScriptUtils#splitSqlScript cannot deal with semicolons in stored procedures
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data type: enhancement
Projects
None yet
Development

No branches or pull requests

1 participant