I think this will only occur if the wiki-forum-to-be is the child forum (somewhere along the lines) of a non-wiki forum that has custom permissions. This query tries to fix inheritance of no wiki-permissions in that case. I will try to figure out what's gone wrong in the code for this.