django-siteflags
django-siteflags copied to clipboard
Getting django.db.utils.DataError: integer out of range with PostgreSQL database
My model looks like this:
class Question(ModelWithFlag):
...
FLAG_BOOKMARK = 10
def bookmark_add(self, user):
return self.set_flag(user, status=self.FLAG_BOOKMARK)
def bookmark_remove(self, user):
return self.remove_flag(user, status=self.FLAG_BOOKMARK)
def bookmark_check(self, user):
return self.is_flagged(user, status=self.FLAG_BOOKMARK)
When the bookmark_add method is run, it throws this error:
psycopg2.errors.NumericValueOutOfRange: integer out of range ... ... File "C:\Users\Tonmoy\Documents\backend\question_db\views.py", line 89, in update instance.bookmark_add(user=request.user) File "C:\Users\Tonmoy\Documents\backend\question_db\models.py", line 158, in bookmark_add return self.set_flag(user, status=self.FLAG_BOOKMARK) django.db.utils.DataError: integer out of range
I've tried changing the status field from IntegerField to BigIntegerField as per some stackoverflow answers but it didn't help.
Thank you for the report.
Please check the latest bookmark and Question IDs. Maybe you have a huge number of those?
Thank you for the report.
Please check the latest bookmark and Question IDs. Maybe you have a huge number of those?
Thanks for your reply. The siteflags_flag table is completely empty, no records at all. I have around 200 questions right now. I forgot to mention that I am using UUID as the primary key, could that be the issue?
My questions table looks like this:

I forgot to mention that I am using UUID as the primary key, could that be the issue?
Seems so. Generic Foreign Key expects Integers to represent a tie between a bookmark and a question.