Master db test fix for PostgreSQL and Oracle

unit tests fixes backported from 1.2 branch for issue #236 and #187
Oracle - test failures bug