Re: Copying only incremental records to another DB.. - Mailing list pgsql-general

From Alban Hertroys
Subject Re: Copying only incremental records to another DB..
Date
Msg-id A0AEB27E-AD7B-4BB3-9E69-0411ABAF2F45@solfertje.student.utwente.nl
Whole thread Raw
In response to Copying only incremental records to another DB..  (Phoenix Kiula <phoenix.kiula@gmail.com>)
Responses Re: Copying only incremental records to another DB..
List pgsql-general
On 29 Jun 2009, at 6:10, Phoenix Kiula wrote:

> Hi
>
> We're trying PG on a new machine, so we copied our current (live)
> database to that server. Tested the code and it's all working. Now, to
> make that second server the main live server, we will need to copy the
> db again including the new records since we copied for testing. Is
> there any way to copy only the incremental records in all the tables?


It would be nice if there were a tool that could do a diff between two
dumps resulting in a new dump with just the statements necessary to
apply the differences. I don't think there is such a tool yet though
(some light Googling does bring up such a tool for sqllite).
Implementing it does have a few challenges, changes to records with
foreign keys for example.

Barring the availability of such a tool, there are some tools out
there that can 'diff' two XML files and, seeing that the xml module
can export tables to a pre-defined XML format, you may be able to do
something using that. What to do with the resulting XML file is
another story, some XSLT could probably turn it back into SQL again.

If the changes aren't many you could probably also work from the
results of a normal diff from two text-dumps and glue them back
together into a usable dump file. Or just apply the changes by hand...

All of these methods involve a bit of work and none is foolproof
(unless the dump-diff tool does exist), but if approached well it
could result in a rather useful tool.

Alban Hertroys

--
If you can't see the forest for the trees,
cut the trees and you'll see there is no forest.


!DSPAM:737,4a6995d910131993413858!



pgsql-general by date:

Previous
From: Jazz Johal
Date:
Subject: Replication from Postgres to EDB
Next
From: Thomas Kellerer
Date:
Subject: Re: Copying only incremental records to another DB..