r11355 committed change.
This causes a SQLException for embedded DBs.
Daryls initial fix was rolled back by Guenther. I might have identified the problem. This issue could be caused by a lacking of casts in the subqueries. I've asked for verification in the discussion thread.
Commited a patch which is based on the proposal from Guus