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

DB2: Clean excludes views whose names end with _V #2287

Closed
armondoortega opened this Issue Jan 29, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@armondoortega
Copy link

armondoortega commented Jan 29, 2019

When running clean on a DB2 database it was noticed that not all views were being dropped correctly.

Looking into the code I found the following method and query:

    private List<String> generateDropStatementsForViews() throws SQLException {
        String dropSeqGenQuery = "select TABNAME from SYSCAT.TABLES where TABSCHEMA = '" + name
                + "' and TABNAME NOT LIKE '%_V' and TYPE='V'";
           return buildDropStatements("DROP VIEW", dropSeqGenQuery);
    }

After validating with the DB2 documention on our the LIKE predicate works, I wanted to validate expected functionality of this query.

Currently this query will exclude any view that ends in 'V', so MY_TEST_V and MY_TEST_IDV will both be excluded.

Is this the intended functionality or was the intention to only exclude names that end in '_V'

We saw this functionality in Flyway 5.2.0 Enterprise Edition and validated the query from the master branch of the project.

@axelfontaine axelfontaine added this to the Flyway 6.0.0 milestone Jan 30, 2019

@axelfontaine axelfontaine changed the title Clean for DB2 doesn't seem to return all views that should be dropped DB2: Clean excludes views whose names end with _V Feb 11, 2019

axelfontaine pushed a commit to flyway/flywaydb.org that referenced this issue Feb 11, 2019

axelfontaine pushed a commit to flyway/flywaydb.org that referenced this issue Feb 11, 2019

@axelfontaine

This comment has been minimized.

Copy link
Contributor

axelfontaine commented Feb 11, 2019

Thanks for reporting. This restriction used to be there in order to filter out the statistical view for an index with an expression-based key. We have now refined our query in order to avoid the side-effect you reported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.