How can I verify that my restored database is identical to my original database?
Here's what I did. Is this a valid way to verify a restore?
# dump mydb_orig:
$ pg_dump --cluster 8.4/my.8.4.cluster mydb_orig > mydb_orig.dump
# create mydb_restored:
$ createdb --cluster 9.1/my.9.1.cluster mydb_restored
# load mydb_orig into mydb_restored:
$ psql -q --cluster 9.1/my.9.1.cluster -d mydb_restored -f mydb_orig.dump
# dump mydb_restored:
$ pg_dump --cluster 9.1/my.9.1.cluster > mydb_restored.dump
# verify mydb_orig and mydb_restored are identical:
$ diff mydb_orig.dump mydb_restored.dump
# The files have the same number of bytes, but some of the rows are in a different order, so sort them:
$ sort mydb_orig.dump > sorted.orig.dump
$ sort mydb_restored.dump > sorted.restored.dump
$ diff sorted.orig.dump sorted.restored.dump
# Now they are identical
pg_restore
did not report any errors, they are identical.