After importing  database, IntegrityError raised for every new record
You need to update the sequence that controls the next value of the primary key.

```sql
SELECT setval('users_id_seq', (SELECT MAX(id) FROM users)+1);
```

For whatever reason, the way you're doing your inserts isn't setting this properly.
I'm importing database like this:
`psql -h localhost -d db_name -U user -f db.sql`

Example of sql query:
```
INSERT INTO public.users(id, email, password) VALUES (1, 'user1@mail.com', 'PASSWORD_HASH');
INSERT INTO public.users(id, email, password) VALUES (2, 'user2@mail.com', 'PASSWORD_HASH');
INSERT INTO public.users(id, email, password) VALUES (3, 'user3@mail.com', 'PASSWORD_HASH');
```

User model:
```
class User(db.Model):
    email = CharField(unique=True)
    password = CharField()
```

After that, I'm trying to create new record, eg. register new user:
```
new_user = User.create(
            email=email,
            password=generate_password_hash(password),
        )
# After creating, redirect user to home page
```

But at this moment `IntegrityError` is raised:
`duplicate key value violates unique constraint "users_pkey" DETAIL: Key (id)=(1) already exists.`

But, without importing the DB, the error does not appear. And new data is successfully saving.