[GENERAL] how to sync the system table with pg_dump

2008-06-05 Thread Gary Fu

Hi,

I tried to use pg_dump to restore (sync) a database, but I noticed that
the system table pg_namespace was not synced.

I tried the following pg_dump command to just restore that table without 
success either.


Does pg_dump support for the system tables or something I missed ?
Is there another way to sync the system tables ?

Thanks,
Gary

% pg_dump -t pg_namespace -h nppdist nppsd3 | psql -h nppsds1 -d nppsd3
SET
SET
SET
SET
SET
SET
SET
SET
ERROR:  relation "pg_namespace" already exists
ALTER TABLE
ERROR:  duplicate key violates unique constraint 
"pg_namespace_nspname_index"

CONTEXT:  COPY pg_namespace, line 1: "pg_toast  10  \N"
ERROR:  permission denied: "pg_namespace" is a system catalog
ERROR:  permission denied: "pg_namespace" is a system catalog
REVOKE
REVOKE
GRANT

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] how to sync the system table with pg_dump

2008-06-05 Thread Albe Laurenz
Gary Fu wrote:
> I tried to use pg_dump to restore (sync) a database, but I noticed that
> the system table pg_namespace was not synced.

If you restore a database, entries in pg_namespace will be created if
the dump contains any CREATE SCHEMA statements, i.e. if there are
schemas in your original database.

Check if the dump was created and restored by a database user with
the appropriate permissions (a superuser ideally), and look out for
error messages.

Do not try to manually change pg_namespace. Just don't.

Yours,
Laurenz Albe

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general