Re: Pg_restore failing due to data inconsistency in dump file

From: Ron <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: Pg_restore failing due to data inconsistency in dump file
Date: 2018-12-13 14:27:49
Message-ID: 3814e222-b3cc-2a0b-cf26-fd9057a1c498@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

No.  That is *not* the first thing to do.

OP needs to find out how the corruption got into the source in the first
place.   There's probably corruption in one of the indexes in
user_role_mapping anduser_entity which support fk_5hrm2vlf9ql5fu043kqepovbr.

On 12/13/2018 06:21 AM, Shreeyansh Dba wrote:
> Hi Soumitra,
>
> Normally this type of error encounter while insert or update data on the
> table, which is dependable on the other table data.
>
> To avoid such error you should disable foreign keys before insert data and
> enable it later.
>
> <http://www.shreeyansh.com>
>
> On Thu, Dec 13, 2018 at 4:50 PM soumitra bhandary
> <soumitra(dot)bhandary(at)hotmail(dot)com <mailto:soumitra(dot)bhandary(at)hotmail(dot)com>> wrote:
>
> Hello Team ,
>
> I have encountered following issue while restoring the Postgres dump
> using pg_restore . Please provide any suggestion to the same .
>
> 1. This dump was taken using bdr_dump as bdr enabled database and all
> the BDR configuration and extension was excluded .
> 2. DUMP was taken in a running DB server where BDR was running .
> 3. Postgres Dump was taken in .dump format .
> 4. During restoration of the same using pg_restore getting following
> error .
>
> Error :
>
> pg_restore:[archiver (db)]Error from TOC entry 3061; 2606 17551 FK
> CONSTRAINT fk_5hrm2vlf9ql5fu043kqepovbr DBNAME
> pg_restore:[archiver (db)]could not execute query: ERROR: insert or
> update on table "user_attribute" violates foreign key constraint
> "fk_5hrm2vlf9ql5fu043kqepovbr"
> DETAIL: Key (user_id)=(1f34ec07-7087-45ff-8a56-f36177752499) is not
> present in table "user_entity".
> Command was: ALTER TABLE ONLY user_attribute
> ADD CONSTRAINT fk_5hrm2vlf9ql5fu043kqepovbr FOREIGN KEY (user_id)
> REFERENCES user_entity...
> pg_restore:[archiver (db)]Error from TOC entry 3065; 2606 17601 FK
> CONSTRAINT fk_c4fqv34p1mbylloxang7b1q3l DBNAME
> pg_restore:[archiver (db)]could not execute query: ERROR: insert or
> update on table "user_role_mapping" violates foreign key constraint
> "fk_c4fqv34p1mbylloxang7b1q3l"
> DETAIL: Key (user_id)=(24d1ee2a-b05e-4c30-a292-84045c47611e) is not
> present in table "user_entity".
>
>
> Thanks ,
>
> Soumitra
>
>

--
Angular momentum makes the world go 'round.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message soumitra bhandary 2018-12-13 14:57:01 Re: Pg_restore failing due to data inconsistency in dump file
Previous Message Shreeyansh Dba 2018-12-13 12:35:42 Re: Pg_restore failing due to data inconsistency in dump file