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

Regression in multiline comments/quotes handling #1264

Closed
alekseevIN opened this issue Mar 31, 2016 · 1 comment
Closed

Regression in multiline comments/quotes handling #1264

alekseevIN opened this issue Mar 31, 2016 · 1 comment
Labels
Milestone

Comments

@alekseevIN
Copy link

What version of Flyway are you using?

4.0

What database are you using (type & version)?

Oracle 11g / 12c

What operating system are you using?

Windows 7

What did you do?

After updating to flyway 4.0 some stored procedures started to fail compilation when updated through flyway.
Managed to track problem to following

Test script to reproduce the issue

create or replace procedure Test_proc
is
begin
    EXECUTE IMMEDIATE 'SELECT 123 num, 321 num2 '||'/*comment with,comma'||'*/ from dual order by num, num2';
end Test_proc;
/

the problem seems to be:
parser splits '/*comment with,comma' into several tokens, one of them is '/*comment
when it is handled by following piece of code inside SqlStatementBuilder

            if (cleanToken.contains("/*")) {
                delimitingTokens.add(TokenType.MULTI_LINE_COMMENT_OPEN);
                handled = true;
            } else if (cleanToken.startsWith("'")) {
                delimitingTokens.add(TokenType.QUOTE);
                handled = true;
            }

' is ignored and as a result number of quotes is uneven.

which ultimately leads to
PLS-00103: Encountered the symbol "/" The symbol "/" was ignored.

Suggestions

modify method protected String simplifyLine(String line) in SqlStatementBuilder to add spaces around quotes(both ' and alternative) and may be around multiline comments /* */
or consider using regex to find required special tokens instead of splitting string

@axelfontaine axelfontaine added this to the Flyway 4.0.1 milestone Mar 31, 2016
axelfontaine pushed a commit to flyway/flywaydb.org that referenced this issue May 5, 2016
@axelfontaine
Copy link
Contributor

Thanks! Fixed.

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

No branches or pull requests

2 participants