You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Heyo @magnusvk, first of all I'm sorry about how vague this bug report is about to be, but it really is all I've got.
At some point we experienced some inconsistencies with the counter culture counts and added a Sidekiq worker that would run at night and fix the counts up if there were any discrepancies. We use AppSignal to track our errors, and an error that periodically comes up for us is this:
PG::UndefinedColumn: ERROR: column "nan" does not exist
LINE 1: UPDATE "invoices" SET total_cost = NaN WHERE "invoices"."id"...
Narrowing this down, it comes from this:
InvoiceItem.counter_culture_fix_counts(where: { account_id: account.id }, only: :invoice)
rescue => e
Appsignal.set_error(e)
end
For reference, here's the relevant schema columns:
create_table "invoice_items", force: :cascade do |t|
... # other columns
t.decimal "total", precision: 9, scale: 3
end
create_table "invoices", force: :cascade do |t|
... # other columns
t.decimal "total_cost", default: "0.0"
end
And the relevant counter_culture definitions
# app/models/invoice_item.rb
class InvoiceItem < ApplicationRecord
counter_culture :invoice, column_name: 'total_cost', delta_column: 'total', touch: true
end
I cannot for the life of me reproduce this locally in any way. I can't figure out how it would be possible for this to become NaN. I've tried:
Creating an invoice with an invoice item with a total of 1.7976931348623157e+308 (max Float value), and adding a second one to try to "overflow" it (still not NaN)
Forcibly setting InvoiceItem.total to NULL
Both of the above at once
This error keeps popping up and I can't in any way make it evaluate to NaN, so this bug report may be completely useless to you, but as a last resort I thought I'd open this issue and see if you have any suggestions or thoughts on how this could possibly become NaN and throw this error?
The text was updated successfully, but these errors were encountered:
I've never seen NaN in Postgres before, but a tiny bit of googling suggests that maybe some of the values you are summing end up as NaN is that possible?
I don't see any indication that this is caused by counter_culture, and nobody else has reported this before. I'm going to close this issue since I don't think I'll be able to help here, but feel free to follow up if you can repro this somehow and tie it to counter_culture.
Heyo @magnusvk, first of all I'm sorry about how vague this bug report is about to be, but it really is all I've got.
At some point we experienced some inconsistencies with the counter culture counts and added a Sidekiq worker that would run at night and fix the counts up if there were any discrepancies. We use AppSignal to track our errors, and an error that periodically comes up for us is this:
Narrowing this down, it comes from this:
For reference, here's the relevant schema columns:
And the relevant
counter_culture
definitionsI cannot for the life of me reproduce this locally in any way. I can't figure out how it would be possible for this to become
NaN
. I've tried:1.7976931348623157e+308
(max Float value), and adding a second one to try to "overflow" it (still not NaN)InvoiceItem.total
to NULLThis error keeps popping up and I can't in any way make it evaluate to NaN, so this bug report may be completely useless to you, but as a last resort I thought I'd open this issue and see if you have any suggestions or thoughts on how this could possibly become NaN and throw this error?
The text was updated successfully, but these errors were encountered: