From: Tom Lane <tgl@sss.pgh.pa.us>
To: ladayaroslav@yandex.ru
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15946: "duplicate key" error on ANALYZE of table partitions in transaction
Date: Sat, 10 Aug 2019 10:23:16 -0400
Message-ID: <618.1565446996@sss.pgh.pa.us> (raw)
In-Reply-To: <15946-5c7570a2884a26cf@postgresql.org>
References: <15946-5c7570a2884a26cf@postgresql.org>
PG Bug reporting form <noreply@postgresql.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, ladayaroslav@yandex.ru
Subject: Re: BUG #15946: "duplicate key" error on ANALYZE of table partitions in transaction
In-Reply-To: <618.1565446996@sss.pgh.pa.us>
References: <15946-5c7570a2884a26cf@postgresql.org> <618.1565446996@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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