Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eKowo-0004Fi-JU for pgsql-bugs@arkaria.postgresql.org; Fri, 01 Dec 2017 17:17:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eKown-0001zo-Vf for pgsql-bugs@arkaria.postgresql.org; Fri, 01 Dec 2017 17:17:57 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eKown-0001zd-N6 for pgsql-bugs@lists.postgresql.org; Fri, 01 Dec 2017 17:17:57 +0000 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eKowg-0003HQ-0n for pgsql-bugs@postgresql.org; Fri, 01 Dec 2017 17:17:56 +0000 Received: by mail-wm0-x235.google.com with SMTP id f140so4582729wmd.2 for ; Fri, 01 Dec 2017 09:17:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=SBdTIME9yQd4rMqor1qwr9vEi62S4EIYrGFpgOln+jc=; b=elGYhSyI+JJxRi8VbBBiG0GAyhhRpH6cPgEHVYonjZKY9I9I6JRTnz8KhNpofrra7H cvyFBWDurch+63OMnRycjWrZRb5s/xLtqbnFi6J+p10/YNbhJ2CXMcb/tjbgPkmGks/N Y99FayoIz7HVApfyQxj0QJ2kdhOdL+XSHk6OAY7UfEFMO/3OCKO3YHpy7xjQc8AbO21O eALYLMglxt+9PKcdqbFz4sJGr4I2zCjVmXLnLJkT7mgh3shnQtqfnIHcZyY84nVV2udu ZbzKEJs/4cTAG8KK3hdO80wSbSysh0KdNpwXHCmcVlPuyJBZY41h+pjp2sMrETElrcmy BDLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=SBdTIME9yQd4rMqor1qwr9vEi62S4EIYrGFpgOln+jc=; b=UKgT6RBKPbJzB2QNyZzc0zqTigx291JtnWu7jAqjH3IRhRBt4SVsL2z4dmQULlFNeJ EBHuy7F6/AFUdPVhXEY1pbqL+eDqXsvVMdAJOv3utVfdF6bA00xhQwZz/Tit/nW6vFgm aY/fdkqu9i1TpRIARgb37Cjl36VthfboAxKepCaxjKn4hJW6JQUx2nNmCwuQAG0Iyuzq IiJ9YPRnJ2Sm2I2t0H96qh97wy57h/QtLzZTtG1UW4B4+NW/dIewjTFlnU/ZSCgOaSHA sWWjrAtDFxtZI8RbB4NjXK6M/3iC5FuUILKPbQsSvYBTSjtloMDScKN3vLE0KggEWORt Uqsw== X-Gm-Message-State: AJaThX6yXVt8lZJCWjwiC97NMQSzXJ/usEfLHig2MK0gzhO1V9qR3whW NkOn893nEQKtiNavhMrOBRkBP4XaDfCvwTda+xPCzu0lv2cf6NjkuICHUn61wjv0916/Sx4E6xf qLE6kCmRqYEHdnErmTGuZPATc3mclfjPCgDT0iB79nqUOjb/6YaMaNbaLLZLyDlL6BtOKsiIvJV CsMJBY X-Google-Smtp-Source: AGs4zMb5hfLCMW7aDaEV31FedrsiNqxASmSHKPcUZhX9Xk2tPXJbS2oIWYmnaLumm91RatHf1+vrIw== X-Received: by 10.28.107.16 with SMTP id g16mr1729346wmc.36.1512148668070; Fri, 01 Dec 2017 09:17:48 -0800 (PST) Received: from [10.137.2.19] (ip-78-102-97-226.net.upcbroadband.cz. [78.102.97.226]) by smtp.gmail.com with ESMTPSA id c2sm8672011wrg.57.2017.12.01.09.17.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Dec 2017 09:17:47 -0800 (PST) Subject: Re: BUG #14940: Duplicated records inspite of primary key and unique constraint To: Alvaro Herrera , sergey.frolov@smetarik.ru Cc: pgsql-bugs@postgresql.org References: <20171201171513.if4pd67kh5sl7u53@alvherre.pgsql> From: Tomas Vondra Message-ID: <5908ac7d-875d-0575-c6fb-06e2985e2986@2ndquadrant.com> Date: Fri, 1 Dec 2017 18:17:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20171201171513.if4pd67kh5sl7u53@alvherre.pgsql> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 12/01/2017 06:15 PM, Alvaro Herrera wrote: > 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 > Oh, haven't noticed this. I wonder if the other cases (supposedly there are 50 duplicate records) look the same way. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services