pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
vacuumdb fails with error pg_statistic_relid_att_inh_index constraint violation after upgrade to 9.6
3+ messages / 2 participants
[nested] [flat]

* vacuumdb fails with error pg_statistic_relid_att_inh_index constraint violation after upgrade to 9.6
@ 2017-11-28 13:25  Swapnil Vaze <swapvaze28@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Swapnil Vaze @ 2017-11-28 13:25 UTC (permalink / raw)
  To: pgsql-general

Hello,

We have upgraded our database from 9.5 to 9.6 version.
After upgrade we ran vacuumdb command and we are getting following error:

vacuumdb: vacuuming of database "advdfat" failed: ERROR:  duplicate key
value violates unique constraint "pg_statistic_relid_att_inh_index"
DETAIL:  Key (starelid, staattnum, stainherit)=(1259, 1, f) already exists.

Can anyone help here?

-- 
Thanks & Regards,
Swapnil Vaze

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: vacuumdb fails with error pg_statistic_relid_att_inh_index constraint violation after upgrade to 9.6
@ 2017-11-28 14:22  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Swapnil Vaze <swapvaze28@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2017-11-28 14:22 UTC (permalink / raw)
  To: Swapnil Vaze <swapvaze28@gmail.com>; +Cc: pgsql-general

Swapnil Vaze <swapvaze28@gmail.com> writes:
> We have upgraded our database from 9.5 to 9.6 version.
> After upgrade we ran vacuumdb command and we are getting following error:
> vacuumdb: vacuuming of database "advdfat" failed: ERROR:  duplicate key
> value violates unique constraint "pg_statistic_relid_att_inh_index"
> DETAIL:  Key (starelid, staattnum, stainherit)=(1259, 1, f) already exists.

Hmm, odd.

> Can anyone help here?

In order of increasing invasiveness:

1. REINDEX pg_statistic_relid_att_inh_index, on the theory that that index
has become corrupt.

2. If #1 fails with a similar message, there must actually be more than
one pg_statistic row with that key.  Manually DELETE those rows, then
REINDEX the index, then ANALYZE pg_class to regenerate the deleted
stats.  (I suggest reindexing because this case makes it even more likely
that that index is corrupt.)

3. If #2 fails, TRUNCATE pg_statistic, then re-analyze everything to
rebuild the stats.

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: vacuumdb fails with error pg_statistic_relid_att_inh_index constraint violation after upgrade to 9.6
@ 2017-11-29 12:07  Swapnil Vaze <swapvaze28@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Swapnil Vaze @ 2017-11-29 12:07 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-general

Hello,
Thanks for the reply.
We deleted those rows and re run vacuum and analyze and it worked fine.
Thanks,

Thanks,
Swapnil Vaze

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2017-11-29 12:07 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-11-28 13:25 vacuumdb fails with error pg_statistic_relid_att_inh_index constraint violation after upgrade to 9.6 Swapnil Vaze <swapvaze28@gmail.com>
2017-11-28 14:22 ` Tom Lane <tgl@sss.pgh.pa.us>
2017-11-29 12:07   ` Swapnil Vaze <swapvaze28@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox