kcal-app / kcal

the personal food nutrition journal
Mozilla Public License 2.0
295 stars 27 forks source link

SQLSTATE[22003]: Numeric value out of range: #37

Closed TartesDaJulia closed 2 years ago

TartesDaJulia commented 2 years ago

Trying to edit a recipe and adding above 99 grams of something gives error:

SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'amount' at row 1 (SQL: update ingredient_amounts set amount = 100, ingredient_amounts.updated_at = 2021-10-31 15:03:27 where id = 7)

cdubz commented 2 years ago

Weird. Will look at this soon. In my use I definitely have values > 99 in ingredient amount fields 🤔

TartesDaJulia commented 2 years ago

Found out editing a food's serving size above 99 leads to a 500 server error, maybe it is connected?

cdubz commented 2 years ago

Ok -- I can indeed reproduce this on the demo. Just not on my own instance of the app. Interesting...

Here's what the full error message looks like --

SQLSTATE[22003]: Numeric value out of range: 7 ERROR: numeric field overflow DETAIL: A field with precision 10, scale 8 must round to an absolute value less than 10^2. (SQL: update "ingredient_amounts" set "amount" = 200, "updated_at" = 2021-11-01 01:50:51 where "id" = 81)

I think I have messed up precision for that field and its just not enforced on SQLite (what my instance uses).

cdubz commented 2 years ago

This is fixed on main -- thanks for reporting!

TheHairyGun commented 11 months ago

Hate to bother, but any chance for this 0.8.1 to be released? I think that I'm running into this as the USDA provides measurements often in portions of 100g.

https://github.com/kcal-app/kcal/issues/55