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

Parsing of string literals #1216

Closed
mabrarov opened this issue Feb 25, 2016 · 2 comments
Closed

Parsing of string literals #1216

mabrarov opened this issue Feb 25, 2016 · 2 comments

Comments

@mabrarov
Copy link

@mabrarov mabrarov commented Feb 25, 2016

Description

I have an issue with this script:

ALTER TRIGGER CUSTOMER_INSERT ON CUSTOMER AFTER
INSERT AS
BEGIN
    SELECT TOP 1 1 FROM CUSTOMER WHERE [name] LIKE'%test';
END
GO

It makes Flyway maven plugin to fail and produce this output:

[ERROR] SQL State  : 42000
[ERROR] Error Code : 102
[ERROR] Message    : Incorrect syntax near 'GO'.

At the same time SQL Server Management Studio (the one shipped with SQL Server 2008 R2) executes this script without errors and modifies the trigger.

If I modify the script this way (if I add whitespace between LIKE and '%test'):

ALTER TRIGGER CUSTOMER_INSERT ON CUSTOMER AFTER
INSERT AS
BEGIN
    SELECT TOP 1 1 FROM CUSTOMER WHERE [name] LIKE '%test';
END
GO

then Flyway maven plugin applies the script successfully.

Repro project

https://github.com/mabrarov/flyway-678/tree/feature/string_literal_parsing_error (i.e.feature/string_literal_parsing_error branch)

Environment

Tested with

  • Java(TM) SE Runtime Environment (build 1.7.0_72-b14).
  • Apache Maven 3.2.3.
  • SQL Server 2008 R2 Developer edition.
@mabrarov
Copy link
Author

@mabrarov mabrarov commented Feb 28, 2016

It seems (tested with SQL Maven Plugin) that this issue is not related to JDBC driver (JTDS is used).

@axelfontaine axelfontaine added this to the flyway-4.0.1 milestone Feb 28, 2016
axelfontaine added a commit to flyway/flywaydb.org that referenced this issue Mar 21, 2016
@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Mar 21, 2016

Thanks for the excellent analysis! Fixed.

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.