pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Alex O'Ree <spyhunter99@gmail.com>
To: Andreas Kretschmer <andreas@a-kretschmer.de>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Merging two database dumps
Date: Wed, 13 Jun 2018 06:32:23 -0700
Message-ID: <b6601646-eae2-1952-1dc8-06d4ed88644c@aklaver.com> (raw)
In-Reply-To: <CALLT8kiHONVhDJxu1_i-2xrqhELxJ2dzOx3MA_OHXD_kxne6Aw@mail.gmail.com>
References: <CALLT8kjR2P0Pj0LMnBk1WrBO1jsvidBWacSpiEikUdEGsXJFWA@mail.gmail.com>
	<64266f8d-9f6c-a333-4220-cce1ad963683@a-kretschmer.de>
	<CALLT8kiHONVhDJxu1_i-2xrqhELxJ2dzOx3MA_OHXD_kxne6Aw@mail.gmail.com>

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 
> <andreas@a-kretschmer.de <mailto:andreas@a-kretschmer.de>> 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 <http://www.2ndQuadrant.com;
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com




view thread (8+ messages)  latest in thread

Message-ID: <b6601646-eae2-1952-1dc8-06d4ed88644c@aklaver.com>
Permalink:  ../b6601646-eae2-1952-1dc8-06d4ed88644c@aklaver.com/
Also on:    postgresql.org/message-id/b6601646-eae2-1952-1dc8-06d4ed88644c@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, spyhunter99@gmail.com, andreas@a-kretschmer.de
  Subject: Re: Merging two database dumps
  In-Reply-To: <b6601646-eae2-1952-1dc8-06d4ed88644c@aklaver.com>
  References: <CALLT8kjR2P0Pj0LMnBk1WrBO1jsvidBWacSpiEikUdEGsXJFWA@mail.gmail.com> <64266f8d-9f6c-a333-4220-cce1ad963683@a-kretschmer.de> <CALLT8kiHONVhDJxu1_i-2xrqhELxJ2dzOx3MA_OHXD_kxne6Aw@mail.gmail.com> <b6601646-eae2-1952-1dc8-06d4ed88644c@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox