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

Incorrect detection of GO keyword inside identifiers #2414

Closed
rglidden opened this issue Jun 17, 2019 · 1 comment

Comments

@rglidden
Copy link

commented Jun 17, 2019

Which version and edition of Flyway are you using?

Flyway Community Edition 6.0.0-beta2 by Boxfuse

If this is not the latest version, can you reproduce the issue with the latest one as well?

(Many bugs are fixed in newer releases and upgrading will often resolve the issue)

Issue only occurs on Flyway 6.0.0-beta2. Issue does not occur on Flyway 5.2.4

Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)

Command Line

Which database are you using (type & version)?

SQL Server 2017 Developer Edition

Which operating system are you using?

Windows 10, 1903

What did you do?

(Please include the content causing the issue, any relevant configuration settings, the SQL statement that failed (if relevant) and the command you ran.)

Create a migration with the following SQL statements, which are valid in SQL Server. Run "flyway migrate":

CREATE OR ALTER PROCEDURE [dbo].[Test]
AS
BEGIN
	DECLARE @DoNotGO INT;
	RETURN 0;
END;
What did you expect to see?

Migrations successfully applied.

What did you see instead?
ERROR: Migration of schema [dbo] to version 0.0.0.3 - FlywayTest failed! Changes successfully rolled back.
ERROR:
Migration V0.0.0_3__FlywayTest.sql failed
-----------------------------------------
SQL State  : S0001
Error Code : 102
Message    : Incorrect syntax near '@DoNot'.
Location   : Operational\baseline\10.10.0\Framework\V0.0.0_3__FlywayTest.sql (C:\git\SmartSuite\Database\Flyway\Operational\baseline\10.10.0\Framework\V0.0.0_3__FlywayTest.sql)
Line       : 1
Statement  : CREATE OR ALTER PROCEDURE [dbo].[Test]
AS
BEGIN
        DECLARE @DoNot

It looks like Flyway is interpreting the GO inside the variable @DoNoGO as a keyword, when it should not be. Interestingly, changing the case on GO allows it to work:

CREATE OR ALTER PROCEDURE [dbo].[Test]
AS
BEGIN
	DECLARE @DoNotgo INT;
	RETURN 0;
END;

@axelfontaine axelfontaine added this to the Flyway 6.0.0 milestone Jun 18, 2019

axelfontaine pushed a commit to flyway/flywaydb.org that referenced this issue Jun 18, 2019
@axelfontaine

This comment has been minimized.

Copy link
Member

commented Jun 18, 2019

Thanks again for another excellent and well researched bug report. This was incredibly valuable in tracking down the root cause for this. Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.