When updating costs and no quantity on hand we got a db error (in newer mysql releases).