rdbms: make Database query error handling more strict