Fixed the optimizer regression causing different from FB2 plans being generated + some cleanup.

git-svn-id: svn+ssh://svn.code.sf.net/p/firebird/code/firebird/trunk@58502 65644016-39b1-43b1-bf79-96bc8fe82c15