Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gXQ4a-0007nX-5i for pgsql-admin@arkaria.postgresql.org; Thu, 13 Dec 2018 12:26:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gXQ4Y-0007Fg-TF for pgsql-admin@arkaria.postgresql.org; Thu, 13 Dec 2018 12:26:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gXQ4Y-0007FZ-3q for pgsql-admin@lists.postgresql.org; Thu, 13 Dec 2018 12:26:34 +0000 Received: from mail-oln040092254010.outbound.protection.outlook.com ([40.92.254.10] helo=APC01-PU1-obe.outbound.protection.outlook.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gXQ4T-0002rl-Vl for pgsql-admin@postgresql.org; Thu, 13 Dec 2018 12:26:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QjECmRKC6fBbYY7dzSpCDSGk7ynUn2T9SSOqW7sFnaw=; b=rTNLFZya2z6af5khqSG+zUiYPi+iDG7nvsfT07sWByTJK7kcVVv5p8rzyvvyx471HYFuyCHyvNDcWoEQUdWdt+KxjLQmtpHZJW6FM/VcXd5ybuwuU41spHz1qs88toNbLUtAonkY8g2ivpHIiVDbyjMmSvv/2U9gSen2SJCR3YKsvY90SN7qTvGuD8emZV+EDzFe8hdp5lQyXndjO+VTga8BhCVln7CIA1ISSWwTPHyX9qB1E/uRiWZ+x50m6ZqboL4oUw788mV9/hot3lJF0Cc3L+TzwjOy3Q3X6b4P5kqHXSh6iS5ed6SauMEGuZXRj1NIf7nbdvwxakeLKzrdZg== Received: from SG2APC01FT048.eop-APC01.prod.protection.outlook.com (10.152.250.57) by SG2APC01HT090.eop-APC01.prod.protection.outlook.com (10.152.250.245) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1425.16; Thu, 13 Dec 2018 12:26:26 +0000 Received: from MA1PR0101MB1687.INDPRD01.PROD.OUTLOOK.COM (10.152.250.51) by SG2APC01FT048.mail.protection.outlook.com (10.152.251.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1425.16 via Frontend Transport; Thu, 13 Dec 2018 12:26:26 +0000 Received: from MA1PR0101MB1687.INDPRD01.PROD.OUTLOOK.COM ([fe80::6485:aa94:bdb0:92c3]) by MA1PR0101MB1687.INDPRD01.PROD.OUTLOOK.COM ([fe80::6485:aa94:bdb0:92c3%7]) with mapi id 15.20.1425.016; Thu, 13 Dec 2018 12:26:26 +0000 From: soumitra bhandary To: Shreeyansh Dba CC: pgsql-admin Subject: Re: Pg_restore failing due to data inconsistency in dump file Thread-Topic: Pg_restore failing due to data inconsistency in dump file Thread-Index: AQHUktXQOXhuyVrPgku4Bbf/jcxSNKV8lyKAgAAA9rM= Date: Thu, 13 Dec 2018 12:26:26 +0000 Message-ID: References: , In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:9ECB4F62F1A6564DFA690BDCFF0E88CB39FEB3E7353C50C90EC61B0A99DB5FFF;UpperCasedChecksum:E6C1185BDFBEBA7FB6F5BD243506CAAD2D838CA1EDE7E1BF616BC92B7E06C9B3;SizeAsReceived:7254;Count:47 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [0qsdRKcjWCpUpNyW9MSJILcuRNyc4dWh] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;SG2APC01HT090;6:v28Oyps0dADgU9CFoKVltXTsUwhOgvhEIdsBoa+jzPvPtyu5lEDJld8jDX3hLXqTUFvThsh4x+rQClN59phd4/vp/l1LT7+m0dbU+6HROwqJGMHUwXYjrZK/6Ur3exzaBAtHUlWGrGJ4rkXwld+3Q4oz3yJ6uNfUZWV5IRBkYNjOuIF/PmMNml1gqoIgDGlCPc5KKufKwtLjEGSyWWU1e5dOEPStNekXNooDiBPB2G+ppq0bly8ptsqlw8FzZwcny8IT3fxOYER5EVQTHelCNODLWRNz1+dACx25gI2EWiWVowmCVBgTlkKBChpmHM0OWiljaQXsHC6y3Tr58Jz3u9e4r/xeM2jewyH/YGmmiZ5Qcpkrx49vd7csRiSHfCpmej24q8js7/oFlgEhCMb41orQyELHnK4ae9Mqpa9e3/H1Fsg3UEqNRGsIYyOGj3674h0hcivIrhTLrLpb0t3JgA==;5:JZKJwdY298RyksR1sUqIWIyJnYYgOy3GEYXiLzpfkoqxOxtrMa/NjU/lLo3zJu7eZhHixrridEd+w+JgG5jUCOZgFuhx3TVpz323um5UpftGZB14XZYjb5hUfpldglutFSU7veQmfNBgic9Zt24E84gKdzZjaNcUgWD9fQBEQCg=;7:lGZG49+eaOQ3gFXmoj7R25hySoAfqIPgspcJjySmcSFsnK3bODnbUOw8O4oswf+6IFEjBM2WmIfWB8Xh4Tg0cqfURodaurC/QDcKX3cv1OEGXWIFlaBHKlwO+txVD/bspIC+7AjbNKPRHcHVxIFeFg== x-incomingheadercount: 47 x-eopattributedmessage: 0 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322404)(1603101475)(1601125500)(1701031045);SRVR:SG2APC01HT090; x-ms-traffictypediagnostic: SG2APC01HT090: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(4566010)(82015058);SRVR:SG2APC01HT090;BCL:0;PCL:0;RULEID:;SRVR:SG2APC01HT090; x-microsoft-antispam-message-info: rMT2sxh7AIV0BzbHEiRRMR3OnImkGBGwr20kRCaSsaPMrY6sozsC7JCG6lOd/XqC Content-Type: multipart/alternative; boundary="_000_MA1PR0101MB16875FEA93D4D03972AC292DE0A00MA1PR0101MB1687_" MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 7181d4b0-87d6-4f4e-ba33-0d3746212cec X-MS-Exchange-CrossTenant-Network-Message-Id: 2ff80cf4-952e-4adb-ffc3-08d660f6337a X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 7181d4b0-87d6-4f4e-ba33-0d3746212cec X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Dec 2018 12:26:26.1111 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2APC01HT090 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --_000_MA1PR0101MB16875FEA93D4D03972AC292DE0A00MA1PR0101MB1687_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi , Thanks for the response . But this one is third party application and dump is restored from dump file= not plain text file . So is there any way to control it ? Thanks, Soumitra ________________________________ From: Shreeyansh Dba Sent: Thursday, December 13, 2018 5:51 PM To: soumitra.bhandary@hotmail.com Cc: pgsql-admin Subject: Re: Pg_restore failing due to data inconsistency in dump file Hi Soumitra, Normally this type of error encounter while insert or update data on the ta= ble, which is dependable on the other table data. To avoid such error you should disable foreign keys before insert data and = enable it later. [https://docs.google.com/uc?export=3Ddownload&id=3D1gGhoMTYjvHWLCZkro06CHfe= V5B0i67aE&revid=3D0B0kMUYo6rsLZRXpXakFESmpyK2NqbG5BOW9zakpWU2U3S3NjPQ] On Thu, Dec 13, 2018 at 4:50 PM soumitra bhandary > 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 th= e 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 err= or . Error : pg_restore: [archiver (db)] Error from TOC entry 3061; 2606 17551 FK CONSTR= AINT fk_5hrm2vlf9ql5fu043kqepovbr DBNAME pg_restore: [archiver (db)] could not execute query: ERROR: insert or updat= e on table "user_attribute" violates foreign key constraint "fk_5hrm2vlf9ql= 5fu043kqepovbr" DETAIL: Key (user_id)=3D(1f34ec07-7087-45ff-8a56-f36177752499) is not prese= nt in table "user_entity". Command was: ALTER TABLE ONLY user_attribute ADD CONSTRAINT fk_5hrm2vlf9ql5fu043kqepovbr FOREIGN KEY (user_id) REFERENCE= S user_entity... pg_restore: [archiver (db)] Error from TOC entry 3065; 2606 17601 FK CONSTR= AINT fk_c4fqv34p1mbylloxang7b1q3l DBNAME pg_restore: [archiver (db)] could not execute query: ERROR: insert or updat= e on table "user_role_mapping" violates foreign key constraint "fk_c4fqv34p= 1mbylloxang7b1q3l" DETAIL: Key (user_id)=3D(24d1ee2a-b05e-4c30-a292-84045c47611e) is not prese= nt in table "user_entity". Thanks , Soumitra --_000_MA1PR0101MB16875FEA93D4D03972AC292DE0A00MA1PR0101MB1687_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi , 

Thanks for the response . 

But this one is third party application and dump is restored from dump file= not plain text file . So is there any way to control it ?

Thanks,
Soumitra 

From: Shreeyansh Dba <sh= reeyansh2014@gmail.com>
Sent: Thursday, December 13, 2018 5:51 PM
To: soumitra.bhandary@hotmail.com
Cc: pgsql-admin
Subject: Re: Pg_restore failing due to data inconsistency in dump fi= le
 
Hi Soumitra,

Normally this type of error encounter while insert or update data on the ta= ble, which is dependable on the other table data.

To avoid such error you should disable foreign keys before insert data and = enable it later.


On Thu, Dec 13, 2018 at 4:50 PM soumitra bhandary <soumitra.bhandary@hotmail.com<= /a>> 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 fol= lowing error . 
Error :&nbs= p;

pg_restore: [archiver (db)] Error from TOC entry 3061; 2606 17551 FK CONSTRAINT fk_5hrm2vlf9ql5fu043k= qepovbr DBNAME
pg_restore: [archiver (db)] could not execute query: ERROR: insert or update on table "user_attr= ibute" violates foreign key constraint "fk_5hrm2vlf9ql5fu043kqepo= vbr"
DETAIL: Key (user_id)=3D(1f34ec07-7087-45ff-8a56-f36177752499) is not prese= nt in table "user_entity".
Command was: ALTER TABLE ONLY user_attribute
ADD CONSTRAINT fk_5hrm2vlf9ql5fu043kqepovbr FOREIGN KEY (user_id) REFERENCE= S user_entity...
pg_restore: [archiver (db)] Error from TOC entry 3065; 2606 17601 FK CONSTRAINT fk_c4fqv34p1mbylloxan= g7b1q3l DBNAME
pg_restore: [archiver (db)] could not execute query: ERROR: insert or update on table "user_role= _mapping" violates foreign key constraint "fk_c4fqv34p1mbylloxang= 7b1q3l"
DETAIL: Key (user_id)=3D(24d1ee2a-b05e-4c30-a292-84045c47611e) is not prese= nt in table "user_entity".


Thanks , 

Soumitra 


--_000_MA1PR0101MB16875FEA93D4D03972AC292DE0A00MA1PR0101MB1687_--