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

SQL version file parsing error #3010

Closed
adipata opened this issue Nov 18, 2020 · 0 comments
Closed

SQL version file parsing error #3010

adipata opened this issue Nov 18, 2020 · 0 comments

Comments

@adipata
Copy link

adipata commented Nov 18, 2020

Which version and edition of Flyway are you using?

6.4.0 - works well, no problem
7.2.0 - throws error

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

command-line

Which database are you using (type & version)?

MariaDB 5.4

Which operating system are you using?

Windows

What did you do?

c:\flyway-7.2.0\flyway -user=root -password=password -url=jdbc:mysql://localhost:3306/database -locations=filesystem:c:/path migrate

Failing version file: V19__Synchronize_production_reporting.sql

CREATE PROCEDURE `report_production`(
	IN `idReq` BINARY(16),
	OUT `ret` INT
)
BEGIN
	DECLARE P INT;
	DECLARE T INT;
	select `quantity_produced`,`quantity` INTO P,T from `requests_kg` where `id`=idReq for update;
	update `requests_kg` set `quantity_produced`=P+1 where `id`=idReq;
	if p+1=t then SET ret=1;
	ELSE SET ret=0;
	END if;
END;
What did you expect to see?
Migrating schema `database` to version 18 - Scheduler synchronization
Migrating schema `database` to version 19 - Synchronize production reporting
Migrating schema `database` to version 20 - Optimistic locking
What did you see instead?
Migrating schema `database` to version "18 - Scheduler synchronization"
Migrating schema `database` to version "19 - Synchronize production reporting"
ERROR: Migration of schema `database` to version "19 - Synchronize production reporting" failed! Please restore backups and roll back database and code!
ERROR:
Migration V19__Synchronize_production_reporting.sql failed
----------------------------------------------------------
SQL State  : 42000
Error Code : 1064
Message    : You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 12
Location   : c:\path\V19__Synchronize_production_reporting.sql (c:\path\V19__Synchronize_production_reporting.sql)
Line       : 1
Statement  : CREATE PROCEDURE `report_production`(
        IN `idReq` BINARY(16),
        OUT `ret` INT
)
BEGIN
        DECLARE P INT;
        DECLARE T INT;
        select `quantity_produced`,`quantity` INTO P,T from `requests_kg` where `id`=idReq for update;
        update `requests_kg` set `quantity_produced`=P+1 where `id`=idReq;
        if p+1=t then SET ret=1;
        ELSE SET ret=0;
        END if

Caused by:
Migration V19__Synchronize_production_reporting.sql failed
----------------------------------------------------------
SQL State  : 42000
Error Code : 1064
Message    : You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 12
Location   : c:\path\V19__Synchronize_production_reporting.sql (c:\path\V19__Synchronize_production_reporting.sql)
Line       : 1
Statement  : CREATE PROCEDURE `report_production`(
        IN `idReq` BINARY(16),
        OUT `ret` INT
)
BEGIN
        DECLARE P INT;
        DECLARE T INT;
        select `quantity_produced`,`quantity` INTO P,T from `requests_kg` where `id`=idReq for update;
        update `requests_kg` set `quantity_produced`=P+1 where `id`=idReq;
        if p+1=t then SET ret=1;
        ELSE SET ret=0;
        END if

Caused by: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants