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

Duplicate key error for Records #61

Open
spacemansteve opened this issue Apr 4, 2018 · 4 comments
Open

Duplicate key error for Records #61

spacemansteve opened this issue Apr 4, 2018 · 4 comments
Assignees

Comments

@spacemansteve
Copy link
Contributor

spacemansteve commented Apr 4, 2018

The error is on the Records table, not ChangeLog as previously thought.
The log file shows:

/usr/local/lib/python2.7/dist-packages/celery/app/trace.py:549: RuntimeWarning: 
Exception raised outside body: 
Retry(Retry(...), IntegrityError('(psycopg2.IntegrityError) 
duplicate key value violates unique constraint 
\"records_bibcode_key\"\\nDETAIL:  Key (bibcode)=(2014arXiv1409.3409Z) already exists.

In Postgres, the key field has a primary key constrain. It is visible with: select * from information_schema.table_constraints where table_name='change_log'.

This does not appear to come from the model definition.

In app.py, ChangeLog entries are added with a simple append operation.

@spacemansteve spacemansteve self-assigned this Apr 4, 2018
@romanchyla
Copy link
Contributor

that's a mistake; either there should be no primary key; or a secondary key in combination with some other (but which field, i dunno - key will eventually result in duplicates; date doesn't make much sense - or does it?)

@spacemansteve
Copy link
Contributor Author

ChangeLog table includes an id field that could serve as the primary key.

@spacemansteve spacemansteve changed the title Duplicate key error for ChangeLog Duplicate key error for Records Apr 5, 2018
@romanchyla
Copy link
Contributor

the id should be the primary; i think the key was only meant to be indexed

@spacemansteve
Copy link
Contributor Author

We are no losing any data due to these errors.

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