[FIX] XQuery: disallow full optimization of opened dbs. Closes #702