I am trying to restore a database from one schema to another schema in postgresql using pgadmin backup and restore utility. The backup is successful for the database A but when I try to do the restore of this to another database B I get the error as shown below.
Do anyone know about this or have faced an issue like this before?
I tried changing the restore options like
Sample:
pg_restore: creating TABLE "public.app_role" pg_restore: [archiver (db)] Error from TOC entry 227; 1259 197811 TABLE app_role schedule pg_restore: [archiver (db)] could not execute query: ERROR: role "schedule" does not exist Command was: ALTER TABLE public.app_role OWNER TO schedule;
Thanks
In PostgreSQL, users and tablespaces are not part of the database, so they are not included in pg_dump
output.
You'll have to run pg_dumpall -g
to get a dump of these objects. Apply that dump first, then it should work.
Alternatively, use the options -O -x
of pg_restore
to skip restoring ownership and permissions. Then the objects will belong to the user who ran pg_restore
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With