Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YFs0J-0000lm-Mc for pgsql-bugs@arkaria.postgresql.org; Mon, 26 Jan 2015 22:19:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YFs0J-0008Lf-5c for pgsql-bugs@arkaria.postgresql.org; Mon, 26 Jan 2015 22:19:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YFs0I-0008Jw-37 for pgsql-bugs@postgresql.org; Mon, 26 Jan 2015 22:19:30 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YFs0E-0002RX-S2 for pgsql-bugs@postgresql.org; Mon, 26 Jan 2015 22:19:28 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id t0QMJNU3017149; Mon, 26 Jan 2015 17:19:23 -0500 From: Tom Lane To: Erik Jones cc: pgsql-bugs@postgresql.org Subject: Re: Duplicate key existant/index visibility bug in 9.3.3 In-reply-to: References: Comments: In-reply-to Erik Jones message dated "Mon, 26 Jan 2015 13:27:19 -0800" Date: Mon, 26 Jan 2015 17:19:23 -0500 Message-ID: <17148.1422310763@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Erik Jones writes: > Today I had a client report an issue restoring a dump made from their production db on a testing server wherein there existed two rows for a table with identical primary key values. FWIW, the simplest explanation for this situation is corruption in your primary key index. That's necessary to explain the rows not being visible through an indexscan, and it's probably sufficient to explain how two rows with the same pkey managed to get in without a unique-index failure. So what I'd suggest is getting rid of whichever row you don't want (DELETE WHERE ctid = something is the best way) and then doing a REINDEX on that index. Now, the REINDEX is going to lock out updates on the table, so it's not a zero-downtime solution ... but it's surely better than a dump and reload. You should definitely also update to 9.3.5 (or next week, 9.3.6) ASAP. Even if this specific problem isn't fixed, there's a bunch of things that *are* fixed and will eventually bite you. 9.3.X has not been one of our most stable release branches :-( regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs