# Update failed due to primary key sequence error

**URL:** <https://meta.discourse.org/t/update-failed-due-to-primary-key-sequence-error/67852>\
**Category:** Self-hosting\
**Created:** [2017 年 8 月 11 日午前 5:51 UTC](https://meta.discourse.org/t/update-failed-due-to-primary-key-sequence-error/67852 "2017-08-11T05:51:42Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)\
**Post date:** [2017 年 8 月 11 日午前 6:56 UTC](https://meta.discourse.org/t/update-failed-due-to-primary-key-sequence-error/67852/4 "2017-08-11T06:56:05Z")

</div>

Well that’s mysterious. I was kinda expecting to find some rando rubbish in that record, but it looks like a regular migration.

More DB investigation: can you provide the output of the following commands, again in the `psql` command line (get in the same way as last time):

```
\d schema_migration_details_id_seq
select count(id),max(id) from schema_migration_details;

```

The first of these should produce a table that includes a line for `last_value`, while the second should just show how many rows and what the max value of the `id` column is. That’ll at least show the nature of the damage, although I doubt it’ll tell us exactly _why_ it happened.

---

_[View the full topic](https://meta.discourse.org/t/update-failed-due-to-primary-key-sequence-error/67852)._
