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