Update %DB::sub

Updated and rebased patch for RT#50524