Unable to decrease block depth below 0 error in version 6.1.1 #2597
Which version and edition of Flyway are you using?
Which client are you using?
Which database are you using (type & version)?
Oracle Database 12c Enterprise Edition Release 18.104.22.168.0 - 64bit Production
Which operating system are you using?
Windows / CentOS
What did you do?
this morning i found that our automated migration testing crashed, which didn't happen yesterday. It crashed with the following error:
I can't provide the whole migration file which crashed, but this is the general idea:
declare ... begin ... for r in ( ... ) loop ... end loop; end; / alter table ... add ( constraint ... unique (...) );
This file has not been changed since yesterday and as I found out, our docker image updated since yesterday from version 6.1.0 to 6.1.1. So it seems like something in 6.1.1 changed, which caused this error.
Hope this helps tracking down this issue.
This is the debug output for that command:
The text was updated successfully, but these errors were encountered:
@SDepn Thanks for reporting this.
Flyway 6.1.1 introduces some changes to the parser which allow us to calculate the block depth, so it seems like your script contains a structure we didn't anticipate.
I'm going to attempt to reproduce the issue with the information you've provided, but it might be that will need a bit more details to get to the bottom of it.
Is there any chance you can share a bit more context on the tokens that come immediately before
Also, are there any other
declare var1 number; var2 number; begin var1 := -1; var2 := -1; for r in ( select * from ( select t.*, count(*) over (partition by [...]) ct from [...] t ) where ct > 1 order by [...] case when [...] then 0 else case when [...] then 1 else 2 end end, case when [...] then [...]-sys_extract_utc(current_timestamp) else sys_extract_utc(current_timestamp)-[...] end ) loop if (var2 <> r.[...] or var1 <> r.[...]) then var2 := r.[...]; var1 := r.[...]; else delete from [...] where [...] = r.[...]; end if; end loop; end; / alter table [...] add ( constraint [...] unique ([...]) );
This is the whole script without variable names, table names, etc.
Hope this helps.