Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dRJ4g-0000uw-Nt for pgsql-general@arkaria.postgresql.org; Sat, 01 Jul 2017 14:08:39 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dRJ4g-0004vE-4n for pgsql-general@arkaria.postgresql.org; Sat, 01 Jul 2017 14:08:38 +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 1dRJ2B-0000N5-Ji for pgsql-general@postgresql.org; Sat, 01 Jul 2017 14:06:03 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dRJ28-0006Qo-DJ for pgsql-general@postgresql.org; Sat, 01 Jul 2017 14:06:02 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id C85A0209A7; Sat, 1 Jul 2017 10:05:58 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute6.internal (MEProxy); Sat, 01 Jul 2017 10:05:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=1neolqpKw2GuX71K4/ vqAZ8OjzhPlSW34a28pJU5M04=; b=cQl5hnTuWTQssK9zy8MENzISavZYAmJXvt EfxV841PljF1XQDRUl3todwkPneYx2XJp5y49oztDI2EJwqOvbpXFQjF8pRFgx97 PCai8iOSKK6oYj7ObmIH/dfCQbjdGAM0I7R6OM9CG8BkAilBb30i2itnLX59dO92 caXryuVu5mI+kcJrOBo9yZBSIbeXVRzS4D4DoGa3qCMuBznlDL9p9vG8zfygTrVa dI3LMM2zJyCPh3IA/InsxqRDF86KwQWS6Tebj1JutuFetCga7Y66xg+gOimpZEze pMs91yOOYL5D2F0IGxoNqphhIRXP60RPv99624QuEHFZQf4KpAbw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= fm1; bh=1neolqpKw2GuX71K4/vqAZ8OjzhPlSW34a28pJU5M04=; b=bfakCVwI eUZCSbU9w2dZbQYsZM7JFDmanfgIsglQp8oBIzJJsIOrRq68x3WeT+SK07Zc4xw5 /K+dZFYcCfZi0ZTUGtn0nqIosPKnYH8V5Xfg/wZTGvMalJ4yzFOjhPaXTYGbZz03 /JIP+UjrRwttZxlhYW7MI82yzWhLOUYrr6Qu0enag4J7jmDT+PckV04U6SLpcmFy 0H5M+GaKfvHPGr7z2FXdOFHLObYuKytfyQdHjQKRUJz6zUVzmbFYVcSzCThzptxf IVodkb8QSdfUvHkFKHCxWD97+vnYTCU33sExBi0Pxw3FuaGxSpl4K5KE2P5HSjZy 0117ce8Z354+TA== X-ME-Sender: X-Sasl-enc: UyTtJSk049Sb2+5puCysdlngvraJ8D7pCTRCKGsUCVWf 1498917958 Received: from [192.168.1.2] (75-165-115-124.tukw.qwest.net [75.165.115.124]) by mail.messagingengine.com (Postfix) with ESMTPA id 134A624254; Sat, 1 Jul 2017 10:05:57 -0400 (EDT) Subject: Re: duplicate key value violates unique constraint and duplicated records To: Steven Chang Cc: Timokhin Maxim , Melvin Davidson , "pgsql-general@postgresql.org" References: <2150831498728539@web17j.yandex.ru> <2597491498823912@web6g.yandex.ru> <3188141498833222@web8j.yandex.ru> <43d3cc17-676f-59a6-8cbe-a46b2b3f2cc3@aklaver.com> From: Adrian Klaver Message-ID: Date: Sat, 1 Jul 2017 07:05:57 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org On 06/30/2017 09:42 PM, Steven Chang wrote: > Uh...we also met duplicate rows with primary key column through > restoring database by pg_basebackup. > HAAAA......................... > I don't think its an issue with primary key index corruption. That is interesting, more information would be helpful though: Postgres version? OS and version? The pg_basebackup command line invocation? Why you don't think it is index corruption? > > > > 2017-07-01 7:30 GMT+08:00 Adrian Klaver >: > > On 06/30/2017 07:33 AM, Timokhin Maxim wrote: > > Sure, here it is. > > pg_basebackup -h servername -R -P -D /data/upgrade/94 -U pgsql > -v —xlog-method=stream —checkpoint=fast > > /usr/pgsql-9.5/bin/initdb -D /data/upgrade/95/ —encoding=utf8 > —locale=ru_RU.utf8 —lc-collate=ru_RU.utf8 —lc-ctype=ru_RU.utf8 > —lc-messages=en_US.utf8 > > Then updating: > /usr/pgsql-9.5/bin/pg_upgrade -b /usr/pgsql-9.4/bin/ -d > /data/upgrade/94 -B /usr/pgsql-9.5/bin/ -D /data/upgrade/95 -k > > and so on to 9.6 > > > The original 9.4 database has the same encoding setup? > > FYI, you can use pg_upgrade to go straight from 9.4 to 9.6. > > https://www.postgresql.org/docs/9.6/static/pgupgrade.html > > > "pg_upgrade supports upgrades from 8.4.X and later to the current > major release of PostgreSQL, including snapshot and alpha releases." > > > > after that server starts normally. > > > -- > Timokhin 'maf' Maxim > > > > > > -- > Adrian Klaver > adrian.klaver@aklaver.com > > -- Adrian Klaver adrian.klaver@aklaver.com -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general