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 with MySQL delimiter in Flyway 3.2 #1222

Closed
fromi opened this issue Mar 1, 2016 · 2 comments
Closed

Regression with MySQL delimiter in Flyway 3.2 #1222

fromi opened this issue Mar 1, 2016 · 2 comments

Comments

@fromi
Copy link

fromi commented Mar 1, 2016

What version of Flyway are you using?

3.2

What database are you using (type & version)?

MySQL

What operating system are you using?

Windows 7 & 10 (local development). Probably not relevant.

What did you do?

(Please include the content causing the issue, any relevant configuration settings, and the command you ran)
A script with a delimiter:

delimiter #

create procedure init_fact_references()
  begin
    start transaction;
      alter table facts add reference int;
      update facts set reference = (position + 1) where publication_date is not null;
      update facts set reference = 0 where publication_date is null;
    commit;
  end #

delimiter ;
What did you expect to see?

The script works fine using Flyway 3.1. I expect it to keep working when I upgrade my Flyway version :)

What did you see instead?
Migration V1.1.9__facts_reference.sql failed
--------------------------------------------
SQL State  : 42000
Error Code : 1064
Message    : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER' at line 13
Location   : db/migration/V1.1/V1.1.9__facts_reference.sql (C:\Users\Romain Fromi\IdeaProjects\ejust\src\main\resources\db\migration\V1.1\V1.1.9__facts_reference.sql)
Line       : 7
Statement  : CREATE PROCEDURE init_fact_references()
  BEGIN
    START TRANSACTION;
    ALTER TABLE facts ADD reference INT;
    UPDATE facts
    SET reference = (position + 1)
    WHERE publication_date IS NOT NULL;
    UPDATE facts
    SET reference = 0
    WHERE publication_date IS NULL;
    COMMIT;
  END #
DELIMITER 

    at org.flywaydb.core.internal.dbsupport.SqlScript.execute(SqlScript.java:117) ~[flyway-core-3.2.1.jar:na]
[...]
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER' at line 13
@axelfontaine
Copy link
Contributor

Thanks. Can you check whether this still occurs with Flyway 4.0?

@fromi
Copy link
Author

fromi commented Mar 1, 2016

We were able to reproduce the problem using Flyway 4.0, 3.2.1 and 3.2.

@axelfontaine axelfontaine added this to the Flyway 4.0.1 milestone Mar 1, 2016
axelfontaine pushed a commit to flyway/flywaydb.org that referenced this issue Mar 22, 2016
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