Faced IntegrityError after manual insertion into postgres table

Hi all,

I have recently done a manual insert into the Postgres DB which is usually handled by Django ORM. Today it is time for Django to insert, the above error is showing.

The Django model is shown here. There are no other keys except for the id.

class CashPosition(models.Model):
date = models.DateField()
volume_type = models.CharField(max_length=24)
sq = models.BooleanField()
buy_positions = models.IntegerField()
sell_positions = models.IntegerField()
net_positions = models.IntegerField()

What is the best way to overcome this problem?
Do I delete the data that I imported in and use django shell to do the insert?


Either import the data without a PK (if possible) or reset the underlying sequence afterwards (to max value + 1).