Re: BUG #15946: "duplicate key" error on ANALYZE of table partitions in transaction

From: naveen mahadevuni <nmahadevuni(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: ladayaroslav(at)yandex(dot)ru, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15946: "duplicate key" error on ANALYZE of table partitions in transaction
Date: 2019-08-13 17:35:39
Message-ID: CAJ8CmBXBiOhQeEYp+Oc=FNaS2eH0Vn1r6fDYsfby7iy7jbO0TQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

hi Tom,

I would like to start contributing to postgres, would like to fix this one
if it hasn't already been done.

Thanks,
Naveen

On Sat, Aug 10, 2019 at 7:53 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> > Running this:
> > ...
> > Throws this error:
> > ERROR: duplicate key value violates unique constraint
> "pg_statistic_relid_att_inh_index"
> > DETAIL: Key (starelid, staattnum, stainherit)=(61056, 1, f) already
> exists.
>
> Hm, you don't need all the fancy partitioning stuff:
>
> regression=# create table t as select generate_series(1,10) x;
> SELECT 10
> regression=# begin;
> BEGIN
> regression=# analyze t, t;
> ERROR: duplicate key value violates unique constraint
> "pg_statistic_relid_att_inh_index"
> DETAIL: Key (starelid, staattnum, stainherit)=(35836, 1, f) already
> exists.
>
> It appears to work fine without the BEGIN:
>
> regression=# analyze t, t;
> ANALYZE
>
> but then
>
> regression=# begin;
> BEGIN
> regression=# analyze t, t;
> ERROR: tuple already updated by self
>
> I think the conclusion is that if we aren't using per-table
> transactions we'd better do a CommandCounterIncrement between
> tables in vacuum()'s loop.
>
> regards, tom lane
>
>
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Jeff Janes 2019-08-13 17:48:22 Re: BUG #15949: pg_basebackup failed(PG-12-Beta3)
Previous Message PG Bug reporting form 2019-08-13 13:11:14 BUG #15953: performance issues using 11.5-1.pgdg+1 over 11.5-1