Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Comparing two postgres dump files

How to compare postgres dump files? I have two dump files, dump1 and dump2 . And I want to compare these two dump files.

Any help will be appreciated..

Thank you

like image 453
Rohita Khatiwada Avatar asked Apr 19 '11 08:04

Rohita Khatiwada


People also ask

How dump all Postgres databases?

pg_dumpall is a utility for writing out (“dumping”) all PostgreSQL databases of a cluster into one script file. The script file contains SQL commands that can be used as input to psql to restore the databases. It does this by calling pg_dump for each database in the cluster.

Where is Postgres dump stored?

sql , which uses the plain or SQL format, the pg_dump command does not store any file anywhere. It just sends the output to STDOUT , which is usually your screen, and it's done. But in your command, you also told your shell (Terminal, Command prompt, whatever) to redirect STDOUT to a file.


2 Answers

You can use beyond compare if windows is been used and use kompare if linux(fedora) is been used also if linux is used than you can use different command like sdiff example is provided in this link, other commands are diff,comm -23 filedump1 fuledump2,sort filedump1 > filedump1.sorted sort fuledump2 > fuledump2.sorted diff filedump1.sorted fuledump2.sorted etc are utilities to compare text in files

like image 128
Bhargav Modi Avatar answered Oct 23 '22 03:10

Bhargav Modi


PostgreSql's dump files are like normal data files.. you can use any utility/tool to see the difference between them.. Most of the OS has build in utilities for this

For example:

  • linux:

vimdiff dump1 dump2 (http://alvinalexander.com/linux-unix/vimdiff-see-multiple-file-differences-visually)

  • On Windows:

fc dump1 dump2 (http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/fc.mspx?mfr=true)

like image 21
Samurai Avatar answered Oct 23 '22 01:10

Samurai