using db_merge for "upsert"