Re: [GENERAL] Table with seemingly duplicated primary key values

2015-12-22 Thread Melvin Davidson
BTW, Jim is referring to the O/S logs for hardware errors, not the PostgreSQL logs. Also, another way of deleting the bad row would be DELETE FROM some_table where ctid = '(79664,59)'; or DELETE FROM some_table where ctid = '(79772,23)'; On Tue, Dec 22, 2015 at 9:44 PM, Jim Nasby wrote: > On

Re: [GENERAL] Table with seemingly duplicated primary key values

2015-12-22 Thread Jim Nasby
On 12/22/15 1:31 PM, Melvin Davidson wrote: The fact that you have rows with an identical id of 2141750 verifies a corrupted primary index. To correct it, you need to decide which row to keep. So review the results of SELECT * FROM some_table WHERE ctid = (79664,59) OR ctid = (79772,23) DELETE

Re: [GENERAL] Table with seemingly duplicated primary key values

2015-12-22 Thread Melvin Davidson
The fact that you have rows with an identical id of 2141750 verifies a corrupted primary index. To correct it, you need to decide which row to keep. So review the results of SELECT * FROM some_table WHERE ctid = (79664,59) OR ctid = (79772,23) DELETE FROM some_table WHERE id = 2147150 AND fi

Re: [GENERAL] Table with seemingly duplicated primary key values

2015-12-22 Thread Aleksander Łukasz
Hi, thanks for your reply. 2015-12-22 16:34 GMT+01:00 Melvin Davidson : > Please. Always, ALWAYS, give the PostgreSQL version and O/S when reporting > a problem. > > First, WHAT IS THE POSTGRESQL VERSION? >WHAT IS THE O/S? > # select version();

Re: [GENERAL] Table with seemingly duplicated primary key values

2015-12-22 Thread Melvin Davidson
Please. Always, ALWAYS, give the PostgreSQL version and O/S when reporting a problem. First, WHAT IS THE POSTGRESQL VERSION? WHAT IS THE O/S? Then try this: select a.ctid, a.id, a.field1, b.ctid, b.id, b.field1 from some_table a, some_table b WHERE a.ct

Re: [GENERAL] Table with seemingly duplicated primary key values

2015-12-22 Thread Tom Lane
=?UTF-8?Q?Aleksander_=C5=81ukasz?= writes: > a table in our database with about 3 million rows ended up in a state > where its seems to have duplicated entries (duplicated primary key values): > ... > Do you have any idea what could be happening and what measures should be > undertaken to fix this

[GENERAL] Table with seemingly duplicated primary key values

2015-12-22 Thread Aleksander Łukasz
Hi, a table in our database with about 3 million rows ended up in a state where its seems to have duplicated entries (duplicated primary key values): # \d some_table; Table "public.some_table" Column |Type |Modifi