pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Thomas Markus <t.markus@proventis.net>
To: pgsql-general General <pgsql-general@postgresql.org>
Subject: Re: duplicate primary key
Date: Wed, 22 Nov 2017 12:34:15 +0100
Message-ID: <0ccb481a-a766-6e93-55e9-7220f5985e75@proventis.net> (raw )
In-Reply-To: <310d960a-2ba1-8754-0848-457a61dae154@rsu.ru >
References: <310d960a-2ba1-8754-0848-457a61dae154@rsu.ru >
Am 22.11.17 um 12:05 schrieb Alexander Pyhalov:
> Hello.
>
> I'm a bit shocked. During import/export of our database we've found a
> duplicate primary key.
>
> # \d player
>
> Table "public.player"
> Column | Type |
> Modifiers
> --------------------+-----------------------------+------------------------------------------------------------------------------------------------------------
>
> id | integer | not null default
> nextval('player_id_seq'::regclass)
> ...
> Indexes:
> "pk_id" PRIMARY KEY, btree (id)
> ...
>
> # select * from pg_indexes where indexname='pk_id';
> schemaname | tablename | indexname | tablespace | indexdef
> ------------+-----------+-----------+------------+------------------------------------------------------
>
> public | player | pk_id | | CREATE UNIQUE INDEX
> pk_id ON player USING btree (id)
>
> # select * from pg_constraint where conname='pk_id';
> -[ RECORD 1 ]-+------
> conname | pk_id
> connamespace | 2200
> contype | p
> condeferrable | f
> condeferred | f
> convalidated | t
> conrelid | 18319
> contypid | 0
> conindid | 18640
> confrelid | 0
> confupdtype |
> confdeltype |
> confmatchtype |
> conislocal | t
> coninhcount | 0
> connoinherit | t
> conkey | {1}
> confkey |
> conpfeqop |
> conppeqop |
> conffeqop |
> conexclop |
> conbin |
> consrc |
>
> # select count(*) from player where id=122224875;
> -[ RECORD 1 ]
> count | 2
>
> The records are identical, besides ctid,xmin,xmax
>
> # select tableoid,ctid,id,xmin,xmax from player where id=122224875;
> tableoid | ctid | id | xmin | xmax
> ----------+--------------+-----------+------------+------------
> 18319 | (9982129,2) | 122224875 | 3149449600 | 3152681810
> 18319 | (9976870,49) | 122224875 | 3149448769 | 3152328995
>
>
>
> I don't understand how this could have happened....
>
Hi Alex,
we got this with a broken index. Fix data and rebuild them. And check
your system/storage
Thomas
view thread (5+ messages) latest in thread
Message-ID: <0ccb481a-a766-6e93-55e9-7220f5985e75@proventis.net>
Permalink: ../0ccb481a-a766-6e93-55e9-7220f5985e75@proventis.net/
Also on: postgresql.org/message-id/0ccb481a-a766-6e93-55e9-7220f5985e75@proventis.net
copy link · copy postgr.es
reply 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-general@postgresql.org
Cc: t.markus@proventis.net
Subject: Re: duplicate primary key
In-Reply-To: <0ccb481a-a766-6e93-55e9-7220f5985e75@proventis.net>
References: <310d960a-2ba1-8754-0848-457a61dae154@rsu.ru> <0ccb481a-a766-6e93-55e9-7220f5985e75@proventis.net>
* 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