Re: BUG #14940: Duplicated records inspite of primary key and uniqueconstraint - Mailing list pgsql-bugs

From Сергей А. Фролов
Subject Re: BUG #14940: Duplicated records inspite of primary key and uniqueconstraint
Date
Msg-id 023c1715-3a10-1a4d-6efd-ccb8823fdfb8@smetarik.ru
Whole thread Raw
In response to Re: BUG #14940: Duplicated records inspite of primary key and uniqueconstraint  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Responses Re: BUG #14940: Duplicated records inspite of primary key and uniqueconstraint  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
List pgsql-bugs
1.  I'll try amcheck after I get system on Debian and if the problem 
will remain after dump/restore.

2. Switthing off enable_indexscan enable_bitmapscan has no effect:

set enable_indexscan = off;
set enable_bitmapscan  = off;

select ctid,xmin,xmax, id, base_id, norm_id from nb.nb_basedtl where id =
11658502;

(0,49);364507;0;11658502;269;46203
(0,49);370881;0;11658502;269;46203
(0,49);370882;0;11658502;269;46203


select ctid,xmin,xmax,id, base_id, norm_id from nb.nb_basedtl where id 
in (select
id from nb.nb_basedtl  group by id having count(1) > 1 ) order by ctid,id
(0,1);364507;0;16101774;321;1239643
(0,1);370881;0;16101774;321;1239643
(0,1);370882;0;16101774;321;1239643
(0,2);370882;0;20365934;425;2
(0,2);370881;0;20365934;425;2
(0,2);364507;0;20365934;425;2
(0,3);370881;0;20365935;425;3
(0,3);364507;0;20365935;425;3
(0,3);370882;0;20365935;425;3
(0,4);370881;0;20365936;425;4
(0,4);364507;0;20365936;425;4
(0,4);370882;0;20365936;425;4
(0,5);364507;0;20365937;425;276807
(0,5);370882;0;20365937;425;276807
(0,5);370881;0;20365937;425;276807
(0,6);370882;0;20365938;425;276808
(0,6);364507;0;20365938;425;276808
(0,6);370881;0;20365938;425;276808
(0,7);370882;0;20365939;425;7
(0,7);364507;0;20365939;425;7
(0,7);370881;0;20365939;425;7
(0,8);370881;0;20365940;425;8
(0,8);364507;0;20365940;425;8
(0,8);370882;0;20365940;425;8
(0,9);370882;0;20365941;425;9
(0,9);370881;0;20365941;425;9
(0,9);364507;0;20365941;425;9
(0,10);370881;0;20365942;425;10
(0,10);370882;0;20365942;425;10
(0,10);364507;0;20365942;425;10
(0,11);364507;0;20365943;425;11
(0,11);370882;0;20365943;425;11
(0,11);370881;0;20365943;425;11
(0,12);370882;0;20365944;425;12
(0,12);364507;0;20365944;425;12
(0,12);370881;0;20365944;425;12
(0,13);370881;0;20365945;425;13
(0,13);364507;0;20365945;425;13
(0,13);370882;0;20365945;425;13
(0,14);370882;0;20365946;425;14
(0,14);364507;0;20365946;425;14
(0,14);370881;0;20365946;425;14
(0,15);364507;0;20365947;425;434507
(0,15);370882;0;20365947;425;434507
(0,15);370881;0;20365947;425;434507
(0,16);370882;0;20365948;425;16
(0,16);364507;0;20365948;425;16
(0,16);370881;0;20365948;425;16
(0,17);370882;0;20365949;425;17
(0,17);370881;0;20365949;425;17
(0,17);364507;0;20365949;425;17
(0,18);370881;0;20365950;425;18
(0,18);364507;0;20365950;425;18
(0,18);370882;0;20365950;425;18
(0,19);370882;0;20365951;425;19
(0,19);370881;0;20365951;425;19
(0,19);364507;0;20365951;425;19
(0,20);364507;0;20365952;425;276809
(0,20);370882;0;20365952;425;276809
(0,20);370881;0;20365952;425;276809
(0,21);370882;0;20365953;425;21
(0,21);370881;0;20365953;425;21
(0,21);364507;0;20365953;425;21
(0,22);370882;0;20365954;425;22
(0,22);364507;0;20365954;425;22
(0,22);370881;0;20365954;425;22
(0,23);370881;0;20365955;425;1492
(0,23);364507;0;20365955;425;1492
(0,23);370882;0;20365955;425;1492
(0,24);370882;0;20365956;425;24
(0,24);370881;0;20365956;425;24
(0,24);364507;0;20365956;425;24
(0,25);370881;0;20365957;425;25
(0,25);364507;0;20365957;425;25
(0,25);370882;0;20365957;425;25
(0,26);370881;0;20365958;425;26
(0,26);364507;0;20365958;425;26
(0,26);370882;0;20365958;425;26
(0,27);370882;0;20365959;425;27
(0,27);364507;0;20365959;425;27
(0,27);370881;0;20365959;425;27
(0,28);370881;0;20365960;425;28
(0,28);364507;0;20365960;425;28
(0,28);370882;0;20365960;425;28
(0,29);370881;0;20365961;425;29
(0,29);364507;0;20365961;425;29
(0,29);370882;0;20365961;425;29
(0,30);364507;0;20365962;425;1497
(0,30);370881;0;20365962;425;1497
(0,30);370882;0;20365962;425;1497
(0,31);370882;0;20365963;425;31
(0,31);364507;0;20365963;425;31
(0,31);370881;0;20365963;425;31
(0,32);370881;0;20365964;425;32
(0,32);364507;0;20365964;425;32
(0,32);370882;0;20365964;425;32
(0,33);370882;0;20365965;425;33
(0,33);370881;0;20365965;425;33
(0,33);364507;0;20365965;425;33
(0,34);364507;0;20365966;425;34
(0,34);370882;0;20365966;425;34
(0,34);370881;0;20365966;425;34
(0,35);364507;0;20365967;425;35
(0,35);370881;0;20365967;425;35
(0,35);370882;0;20365967;425;35
(0,36);370882;0;20365968;425;36
(0,36);370881;0;20365968;425;36
(0,36);364507;0;20365968;425;36
(0,37);364507;0;20365969;425;37
(0,37);370881;0;20365969;425;37
(0,37);370882;0;20365969;425;37
(0,38);370882;0;20365970;425;38
(0,38);370881;0;20365970;425;38
(0,38);364507;0;20365970;425;38
(0,39);370881;0;20365971;425;39
(0,39);364507;0;20365971;425;39
(0,39);370882;0;20365971;425;39
(0,40);370882;0;20365972;425;40
(0,40);364507;0;20365972;425;40
(0,40);370881;0;20365972;425;40
(0,41);364507;0;20365973;425;1507
(0,41);370881;0;20365973;425;1507
(0,41);370882;0;20365973;425;1507
(0,42);370881;0;20365974;425;42
(0,42);364507;0;20365974;425;42
(0,42);370882;0;20365974;425;42
(0,43);370881;0;20365975;425;43
(0,43);364507;0;20365975;425;43
(0,43);370882;0;20365975;425;43
(0,44);364507;0;11658485;269;46190
(0,44);370882;0;11658485;269;46190
(0,44);370881;0;11658485;269;46190
(0,45);370881;0;12066836;280;95258
(0,45);370882;0;12066836;280;95258
(0,45);364507;0;12066836;280;95258
(0,46);370881;0;11658496;269;46194
(0,46);370882;0;11658496;269;46194
(0,46);364507;0;11658496;269;46194
(0,47);370882;0;11658494;269;46196
(0,47);370881;0;11658494;269;46196
(0,47);364507;0;11658494;269;46196
(0,48);364507;0;11658492;269;46197
(0,48);370881;0;11658492;269;46197
(0,48);370882;0;11658492;269;46197
(0,49);370882;0;11658502;269;46203
(0,49);370881;0;11658502;269;46203
(0,49);364507;0;11658502;269;46203
(0,50);364507;0;11658508;269;46204
(0,50);370882;0;11658508;269;46204
(0,50);370881;0;11658508;269;46204

regards,

Sergey.

01.12.2017 20:15, Alvaro Herrera пишет:
> sergey.frolov@smetarik.ru wrote:
>
>> select ctid,xmin,xmax, id, base_id, norm_id from nb.nb_basedtl where id =
>> 11658502 ;-- expected ONE row
>>
>> (0,49);364507;0;11658502;269;46203
>> (0,49);370881;0;11658502;269;46203
>> (0,49);370882;0;11658502;269;46203
> Since these rows all have the same CTID, it looks like the index on id
> must be corrupt and returned the same tuple more than once.  But the
> weird thing is that the xmin differs ...  How can that be?  Does this
> change if you set enable_indexscan and enable_bitmapscan to off?
>
> Would you try running amcheck on this index?
> https://github.com/petergeoghegan/amcheck
>



pgsql-bugs by date:

Previous
From: ptim007@yahoo.com
Date:
Subject: BUG #14943: error in rpm package pgpool-II published in repo pgdg10
Next
From: Сергей А. Фролов
Date:
Subject: Re: BUG #14940: Duplicated records inspite of primary key and uniqueconstraint