-
-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
I'm now getting this error when trying to rate any object of a specific class. No code changes occurred; seems something is messed up in the database.
Is there a way to rebuild the cache or something?
ActiveRecord::RangeError (PG::NumericValueOutOfRange)
ERROR: numeric field overflow
DETAIL: A field with precision 17, scale 14 must round to an absolute value less than 10^3.
D, [2020-02-19T18:40:05.800251 #4] DEBUG -- : (1.2ms) BEGIN
D, [2020-02-19T18:40:05.810753 #4] DEBUG -- : Rating::Rate Exists? (1.5ms) SELECT 1 AS one FROM "rating_rates" WHERE "rating_rates"."author_id" = $1 AND "rating_rates"."author_type" = $2 AND "rating_rates"."resource_id" = $3 AND "rating_rates"."resource_type" = $4 AND "rating_rates"."scopeable_id" IS NULL AND "rating_rates"."scopeable_type" IS NULL LIMIT $5 [["author_id", 1], ["author_type", "User"], ["resource_id", 465], ["resource_type", "Response"], ["LIMIT", 1]]
D, [2020-02-19T18:40:05.816499 #4] DEBUG -- : Rating::Rate Create (1.8ms) INSERT INTO "rating_rates" ("value", "author_type", "author_id", "resource_type", "resource_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id" [["value", "5.0"], ["author_type", "User"], ["author_id", 1], ["resource_type", "Response"], ["resource_id", 465], ["created_at", "2020-02-19 18:40:05.812490"], ["updated_at", "2020-02-19 18:40:05.812490"]]
D, [2020-02-19T18:40:05.823025 #4] DEBUG -- : Rating::Rating Load (4.0ms) SELECT "rating_ratings".* FROM "rating_ratings" WHERE "rating_ratings"."resource_type" = $1 AND "rating_ratings"."resource_id" = $2 AND "rating_ratings"."scopeable_id" IS NULL LIMIT $3 [["resource_type", "Response"], ["resource_id", 465], ["LIMIT", 1]]
D, [2020-02-19T18:40:05.830376 #4] DEBUG -- : Rating::Rate Load (3.0ms) SELECT (CAST(( SELECT GREATEST(COUNT(1), 1) FROM rating_rates WHERE resource_type = 'Response' AND scopeable_type is NULL ) AS DECIMAL(17, 14)) / ( SELECT GREATEST(COUNT(DISTINCT resource_id), 1) FROM rating_rates WHERE resource_type = 'Response' AND scopeable_type is NULL )) count_avg, COALESCE(AVG(value), 0) rating_avg FROM rating_rates WHERE resource_type = 'Response' AND scopeable_type is NULL
D, [2020-02-19T18:40:05.832288 #4] DEBUG -- : (1.2ms) ROLLBACK
Reactions are currently unavailable