Cannot recreate DB scheme using pg_dump

From: Nishad Prakash <prakashn(at)uci(dot)edu>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Cannot recreate DB scheme using pg_dump
Date: 2004-07-16 23:22:21
Message-ID: Pine.GSO.4.58.0407161621230.16729@e4e.oac.uci.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2004-07-17 04:04:40 Re: Slow views
Previous Message Peter Eisentraut 2004-07-16 22:02:24 Re: \ escapes in check constraint strings?