Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fT5t0-0001E1-F8 for pgsql-general@arkaria.postgresql.org; Wed, 13 Jun 2018 13:32:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fT5sy-0007f6-PX for pgsql-general@arkaria.postgresql.org; Wed, 13 Jun 2018 13:32:28 +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.89) (envelope-from ) id 1fT5sy-0007ev-DC for pgsql-general@lists.postgresql.org; Wed, 13 Jun 2018 13:32:28 +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.89) (envelope-from ) id 1fT5sv-0002VW-Ej for pgsql-general@lists.postgresql.org; Wed, 13 Jun 2018 13:32:26 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id CD53A20EB1; Wed, 13 Jun 2018 09:32:24 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 13 Jun 2018 09:32:24 -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; s=fm3; bh=wt5XCPTACO9iNbUQtT2aR4VwAjfMT 2f+PQcaSNHZ0fM=; b=gEs7v38VnNNpcnpY7BatyIG+xjJ3jnKSMNyRCkeryQskI JDFsaC2wAw0S3ul8EcdcooG+aL72Q0hmg0CBBSdIVkGVUNvilomUw6cMYtJPOJB0 HImJGLySRFDmf8Bm7whxM+UU4FbGD2s8tRQz0ZUiSqEcME/R9CkbjanzzghMCS3v 3cLpSEYDDBj4jmgpovSivSNz1SQsTbbBawXEFX1qzcpWBp8uFJiadagblonYHfdK 75KSOaiW0ITNTfnN8J0vxSpqhPyb87B3MVfdpC0WqcSwAd7WsmhdkRThY1JZ3ZD9 OB4wGy1OeB/8aDbgoHaeSCzBVKAUDnEypLl+P/Ncg== 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; s=fm3; bh=wt5XCP TACO9iNbUQtT2aR4VwAjfMT2f+PQcaSNHZ0fM=; b=azD++M6G6jyFJn9ln/RlXz DK3JdGcSebmIFoytg5VAAXapy9GbIBc02WJB3Zofs56xilsMzqtXMmu9IIwtY216 0/1F5VRGnpkngw0OwqadYwUwHOllMS8gNh1vHSVF/yy6Ip5DyUiIiM3T9lnjlhEj MDcYuQ7X9GbnLaypcsJU2s4F12MiyxzQysAWA7nKKWa9LDs67Rb7F3Fo0soCz3BS 7PqjUtkjjHRPHqe5Mf/Sv43F9bumTOhhowtyZBKVKaKS0lknMbw6jrhl0wMe+h3w WmVy0Npf+hNlPAng8xlueNWn6yh6XeYj5/llS6+tIkJnZZa3Qf/qLENm67qJWefg == X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Sender: Received: from [192.168.1.3] (unknown [71.212.159.209]) by mail.messagingengine.com (Postfix) with ESMTPA id 0E88110255; Wed, 13 Jun 2018 09:32:23 -0400 (EDT) Subject: Re: Merging two database dumps To: Alex O'Ree , Andreas Kretschmer Cc: pgsql-general@lists.postgresql.org References: <64266f8d-9f6c-a333-4220-cce1ad963683@a-kretschmer.de> From: Adrian Klaver Message-ID: Date: Wed, 13 Jun 2018 06:32:23 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 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-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 06/13/2018 06:21 AM, Alex O'Ree wrote: > Desired behavior is to just log the error and continue the import using > pgdump based copy commands Each COPY is atomic so if any part of it fails the whole thing fails, so you will not be able to achieve what you want that way. > > The servers are not on the same network.  Sneaker net is the only way > > On Wed, Jun 13, 2018, 7:42 AM Andreas Kretschmer > > wrote: > > > > Am 13.06.2018 um 13:17 schrieb Alex O'Ree: > > I have a situation with multiple postgres servers running all > with the > > same databases and table structure. I need to periodically export > the > > data from each of there then merge them all into a single server. On > > occasion, it's feasible for the same record (primary key) to be > stored > > in two or more servers > > what should happen in this case? > > > > > I was using pgdump without the --insert option however I just > noticed > > that pgrestore will stop inserting into a table when the conflict > > occurs, leaving me with an incomplete set. > > > > Other solution: > > * create the tables on the destination server without the PK or with an > other, new PK (maybe SERIAL) > * use logical replication to replicate the table from all your > source-db's to the destination table, see more here: > https://www.2ndquadrant.com/en/resources/pglogical/ > > your problem seems as a typical task for logical replication to me. You > needs 9.4 at least. > > > Regards, Andreas > > -- > 2ndQuadrant - The PostgreSQL Support Company. > www.2ndQuadrant.com > > -- Adrian Klaver adrian.klaver@aklaver.com