Re: duplicate key value violates unique constraint and duplicated records

From: Timokhin Maxim <ncx2(at)yandex(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Cc: Melvin Davidson <melvin6925(at)gmail(dot)com>, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, "stevenchang1213(at)gmail(dot)com" <stevenchang1213(at)gmail(dot)com>
Subject: Re: duplicate key value violates unique constraint and duplicated records
Date: 2017-07-28 14:34:43
Message-ID: 4535691501252483@web21j.yandex.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello, everybody.
I solved the problem. The index has been corrupted after replication despite it was appeared as not corrupted.
It was solved by recreating the index.
Thank you for the help.

--
Пожалуйста!
Используйте кнопку "ответить всем".
Не удаляйте историю переписки.
Спасибо. С уважением, Timokhin 'maf' Maxim

30.06.2017, 17:33, "Timokhin Maxim" <ncx2(at)yandex(dot)com>:
> 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
>
> after that server starts normally.
>
> --
> Timokhin 'maf' Maxim
>
> 30.06.2017, 16:07, "Adrian Klaver" <adrian(dot)klaver(at)aklaver(dot)com>:
>>  On 06/30/2017 04:58 AM, Timokhin Maxim wrote:
>>>   BTW, we are moving using:
>>>
>>>   pg_basebackup -h servername -R -P -D /data/upgrade/94 -U pgsql -v —xlog-method=stream —checkpoint=fast
>>
>>  Going from 9.4 to 9.6 is a major version upgrade and you cannot use
>>  pg_basebackup for that. Besides I can't see how you even got the 9.6.3
>>  server to start:
>>
>>  /usr/local/pgsql94/bin/pg_basebackup -D /home/aklaver/pgback_test94 -U
>>  postgres -p 5412 -v --xlog-method=stream
>>
>>  /usr/local/pgsql96/bin/pg_ctl -D /home/aklaver/pgback_test94/ start
>>  server starting
>>  FATAL: database files are incompatible with server
>>  DETAIL: The data directory was initialized by PostgreSQL version 9.4,
>>  which is not compatible with this version 9.6.3
>>
>>>   After that we are upping version to 9.6.3.
>>
>>  Given the above how did you actually get 9.6.3 to start?
>>
>>>   I've looked through the documentation https://postgrespro.ru/docs/postgrespro/9.6/app-pgbasebackup and didn't find details about how pg_basebackup works with b-tree indexes.
>>>   Is it possible that pg_basebackup just copies indexes as is and that is cause of corruption. Or it pass indexes as instruction that says "after upping db make indexes" ?
>>>
>>>   Thank you.
>>>
>>>   --
>>>   Timokhin 'maf' Maxim
>>
>>  --
>>  Adrian Klaver
>>  adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Geoghegan 2017-07-28 18:41:09 Re: upsert: is there a shortcut?
Previous Message Tom Lane 2017-07-28 14:18:54 Re: RETURNS SETOF RECORD with 1 column