Database: added test for caching joining column in case of empty join resultset
Database: fixed caching joining column in case of empty join resultset