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

Change of Delimiter does not work correct for SQLite #1081

stkuehnl opened this issue Aug 12, 2015 · 1 comment

Change of Delimiter does not work correct for SQLite #1081

stkuehnl opened this issue Aug 12, 2015 · 1 comment


Copy link

I would create the following two tables in a SQLite Database by using flyway:

CREATE TABLE my_patch_level
    db_id                     INTEGER PRIMARY KEY autoincrement,
    db_level                  NUMBER (3) NOT NULL ,
    db_svn                    VARCHAR2 (35) NOT NULL ,
    db_zp_beginn              DATE NOT NULL ,
    db_zp_ende                DATE
   ) ;
CREATE TABLE adr_verfahren
    vrf_id   INTEGER PRIMARY KEY autoincrement ,
    vrf_knz  VARCHAR2 (3) NOT NULL ,
    vrf_name VARCHAR2 (80) ,
    vrf_zid  NUMBER (12) ,
    vrf_dm   DATE DEFAULT (datetime('now','localtime'))
  ) ;

After executing the script with flyway - there has been created only one table without any exception.
I have debug flyway. The class SQLiteSqlStatementBuilder overrides the method changeDelimiterIfNecessary. In this method flyway checks if it is necessary to change the delimiter. This is useful for database-specific stored procedures or trigger. But in my case - there is no stored procedures or trigger.
Due the column db_zp_beginn (in my first table) the following code assigned the field insideBeginEndBlock to true and the method returns null for the delimiter and flyway puts all the following statemets to the current statement.
Here the code:

    protected Delimiter changeDelimiterIfNecessary(String line, Delimiter delimiter) {
        if (line.contains("BEGIN")) {
            insideBeginEndBlock = true;

        if (line.endsWith("END;")) {
            insideBeginEndBlock = false;

        if (insideBeginEndBlock) {
            return null;
        return getDefaultDelimiter();

The condition for setting the field insideBeginEndBlock should be fixed. There could also be a problem if I would insert a text in a column which contains begin or if I have a column such as beginners.

@axelfontaine axelfontaine added this to the Flyway 4.0 milestone Oct 28, 2015
axelfontaine pushed a commit to flyway/ that referenced this issue Oct 28, 2015
Copy link

Thanks for researching this! Fixed.

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

No branches or pull requests

2 participants