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

Clean unable to drop function in db2 #1154

Closed
msallstr opened this issue Jan 7, 2016 · 2 comments
Closed

Clean unable to drop function in db2 #1154

msallstr opened this issue Jan 7, 2016 · 2 comments

Comments

@msallstr
Copy link
Contributor

@msallstr msallstr commented Jan 7, 2016

I'm getting the following db2 error when trying to run clean

[ERROR] Failed to execute goal org.flywaydb:flyway-maven-plugin:3.2.1:clean (default) on project uppfoljning: org.flywaydb.core.api.FlywayException: Unable to drop "TEST_FUNC(CHARACTER,CHARACTER): DB2 SQL Error: SQLCODE=-458, SQLSTATE=42883, SQLERRMC=UPPFOLJNING.TEST_FUNC, DRIVER=4.19.26 -> [Help 1]

From the db2 documentation
For example, assuming a function exists for which a parameter was defined as CHAR(12) on the CREATE FUNCTION statement, a reference to that function by a signature could specify this parameter as either CHAR(12), or CHAR(). The CHAR() syntax provides a way to say, "do not care about length, precision and scale attributes in finding a matching function".

A simple test case

CREATE FUNCTION TEST_FUNC ( PARAM1 char(16), PARAM2 char(36) ) 
   RETURNS INTEGER 
   LANGUAGE SQL 
RETURN 1; 

drop function test_func(character, character); -- fails
drop function test_func(character(), character()); -- succeeds
drop function test_func(character(16), character(36)); -- succeeds

To never care about length may be the way to fix this.

Using flywaydb version 3.2.1 and DB2 v10.5.500.107 with fixpack 5

umefjord pushed a commit to umefjord/flyway that referenced this issue Jan 8, 2016
@pswrdf
Copy link

@pswrdf pswrdf commented Jan 18, 2016

DB2 v9.7 Flyway doesn't drops a function on clean operation (from java):

CREATE FUNCTION db2admin.get_version()
RETURNS VARCHAR(16)
SPECIFIC "GET_VERSION"
NO EXTERNAL action F1:
BEGIN atomic
RETURN '7.0.0';
END

console show no errors:
1:44:06 PM org.flywaydb.core.internal.command.DbClean cleanSchema
INFO: Cleaned schema "DB2ADMIN" (execution time 00:00.016s).

But fails on followed by migrate operation: Found non-empty schema "DB2ADMIN" without metadata table!
And the function still exists in schema.

@axelfontaine axelfontaine added this to the Flyway 4.0 milestone Jan 18, 2016
axelfontaine added a commit that referenced this issue Jan 19, 2016
#1154 - Drop functions with length attributes in DB2
@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Jan 19, 2016

Fixed thanks to #1155 by @umefjord

axelfontaine added a commit to flyway/flywaydb.org that referenced this issue Jan 19, 2016
axelfontaine added a commit to flyway/flywaydb.org that referenced this issue Jan 19, 2016
axelfontaine added a commit that referenced this issue Jan 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.