Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres DatetimeFieldOverflow #16

Closed
harlantwood opened this issue Feb 23, 2015 · 5 comments
Closed

Postgres DatetimeFieldOverflow #16

harlantwood opened this issue Feb 23, 2015 · 5 comments

Comments

@harlantwood
Copy link

We have had a few production errors like this one:

The user is searching for 00393488235373. Searchcop searches a number of fields, including some which are date/timestamps, treating this integer as a year. Postgres gets upset because the year is too large for it, and crashes, something like:

PG::DatetimeFieldOverflow: ERROR:  date/time field value out of range: "393488235373-01-01 00:00:00.000000"
LINE 1: ...'%00393488235373%' OR ("accounts"."created_at" >= '393488235...
                                                             ^
: SELECT [...snipped...] WHERE (("accounts"."first_name" ILIKE '%00393488235373%' OR "accounts"."last_name" ILIKE '%00393488235373%' OR "accounts"."email" ILIKE '%00393488235373%' OR "accounts"."phone" ILIKE '%00393488235373%' OR ("accounts"."created_at" >= '393488235373-01-01 00:00:00.000000' AND "accounts"."created_at" <= '393488235373-12-31 23:59:59.999999') OR  [...snipped...] 
mrkamel pushed a commit that referenced this issue Feb 24, 2015
@mrkamel
Copy link
Owner

mrkamel commented Feb 24, 2015

Hi, thanks for the report. Should now be fixed in master by limiting the year-recognition to YYYY. However, now we're running into a Y10K bug :-)

@harlantwood
Copy link
Author

Awesome, thanks for the quick fix!

@harlantwood
Copy link
Author

I'll set a calendar reminder for 9999 to file a bug : )

@mrkamel
Copy link
Owner

mrkamel commented Mar 7, 2015

v1.0.6 is out to officially fix this

@mrkamel mrkamel closed this as completed Mar 7, 2015
@harlantwood
Copy link
Author

Great, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants