CGrateS MySQL Rounding Error

I put my rates in with a stack of decimal points, because accuracy matters!

But when I manually calculated the outputted costs associated with each transaction, I seemed to have some rounding errors.

So what was the issue?

The schema in MySQL was set to DECIMAL(10,4) which gives us 10 digits after the decimal point and 4 digits after.

A quick alter table and a reimport of the rates and I was on my way!

"alter table tp_rates modify column  rate DECIMAL(10,10);"

Lesson learned and hopefully of use to any other CGrateS users who may be using MySQL as a StoreDB.

One thought on “CGrateS MySQL Rounding Error

  1. SQL query:
    alter table tp_rates modify column rate DECIMAL(10,10)

    MySQL said:
    #1264 – Out of range value for column ‘rate’ at row 1

Leave a Reply

Your email address will not be published. Required fields are marked *