Cannot recreate DB scheme using pg_dump - Mailing list pgsql-bugs

From Nishad Prakash
Subject Cannot recreate DB scheme using pg_dump
Date
Msg-id Pine.GSO.4.58.0407161621230.16729@e4e.oac.uci.edu
Whole thread Raw
Responses Re: Cannot recreate DB scheme using pg_dump  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
I'm trying to create a new database whose schema is the same as one
that already exists.  To my surprise, the following steps don't work:

1) pg_dump -s db1 > db1_schema
2) createdb db2
3) psql -f db1_schema db2

Both db1 and db2 are created by the user "Bob", who also owns all the
tables in db1.  Now, if step (3) is performed by Bob, then C language
functions are not re-created, for lack of permission.  If step (3) is
perfomed by the postgres superuser, then certain indices and foreign
key constraints are not re-created and I see the error "must be owner
of relation <foo>".

Am I doing something wrong?  Is there a better way to do this?

Nishad
--
"Underneath the concrete, the dream is still alive" -- Talking Heads

pgsql-bugs by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: \ escapes in check constraint strings?
Next
From: Tom Lane
Date:
Subject: Re: Slow views