Fixes for DBQuery::onDuplicateKey