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

Redshift: clean schema fails if there is a procedure present #2684

Closed
jaiseban opened this issue Feb 21, 2020 · 2 comments
Closed

Redshift: clean schema fails if there is a procedure present #2684

jaiseban opened this issue Feb 21, 2020 · 2 comments

Comments

@jaiseban
Copy link

@jaiseban jaiseban commented Feb 21, 2020

Which version and edition of Flyway are you using?

Flyway Community Edition 6.2.4 by Redgate

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)

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

Command-line

Which database are you using (type & version)?

AWS Redshift

Which operating system are you using?

Executes through flyway/flyway docker image

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.)

Our migration script includes a stored procedure. During DB migration, we don't face any issues and procedure gets created. But during flyway clean command execution, we get below error

Message : Amazon Invalid operation: function .(character varying, character varying) does not exist

After looking into the flyway code, observed that the clean action does not differentiate the "procedure" and "function". ie org.flywaydb.core.internal.database.redshift.RedshiftSchema->generateDropStatementsForRoutines() does not differentiate procedure. The procedure also treated like function and execute with command "drop function" instead of "drop procedure".

Instead, we should use PG_PROC_INFO-> prokind to differentiate procedure and function to generate a respective drop statement.

What did you expect to see?

The clean command should handle the procedure clean

What did you see instead?

The clean command fails with below error in Redshift DB if the stored procedure exists
Amazon Invalid operation: function .(character varying, character varying) does not exist

@jaiseban
Copy link
Author

@jaiseban jaiseban commented Feb 21, 2020

Note that this issue happens only if schemaHistory.hasSchemasMarker() return false

@juliahayward
Copy link
Member

@juliahayward juliahayward commented Mar 4, 2020

I have a reproduction, fix will be in 6.3

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

3 participants