cant get pg_dump/pg_restore to behave - Mailing list pgsql-general

From Mike Frysinger
Subject cant get pg_dump/pg_restore to behave
Date
Msg-id 8bd0f97a0704192220p3635677fo4245ca2fc93b38a3@mail.gmail.com
Whole thread Raw
Responses Re: cant get pg_dump/pg_restore to behave  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
i'm trying to add the ability to dump our database as a backup in case
things go wrong with the db server, and so i'm trying to test things
now so that if/when things do go bad, i'm not scrambling then :)

as a test, i'm just trying to dump a database's schema and restore
that ... but it seems like pg_dump doesnt dump things in order so when
i restore the dump, i get bunches of errors about things not existing
... looking at the actual dump, i can see the tables pg_restore is
complaining about have operations run on it before the actual CREATE
sql ...

$ pg_dump -F c -s -d database-server mydb > mydb.schema
$ psql -d mydb < mydb.schema
<error about users_idx not existing>
$ grep users_idx mydb.schema
 INSERT INTO users_idx (....
 UPDATE users_idx SET ...
 -- Name: users_idx; Type: TABLE; ...
 CREATE TABLE users_idx (...

err, shouldnt that CREATE be first ?
-mike

pgsql-general by date:

Previous
From: Brent Wood
Date:
Subject: Re: selective export for subsequent import (COPY)
Next
From: Guy Rouillier
Date:
Subject: Technical Documentation and Community Login