I’m using an mac mini m1 and postgresl14 on it for a database migration.
For the migration a change of the owner is necessary.
I’m askin this question here, because the registration progress on www.postgresql.org also failed with “An unhandled exception occurred during the authentication process” during oauth, very nice 🙁
To export the dump needed i do log in on my mac, call sudo su to become root and use the following cmd:
pg_dump -Fc --no-owner --encoding=UTF8 -h 127.0.0.1 -U postgres [[dbname]] -n [[schemaname]] > upload.bak
where [[dbname]] and [[schemaname]] are placeholders here.
After that, i upload the upload.bak file to my server instance of ubuntu24.
On that ubuntu server instance i try to import the file via
pg_restore -h 127.0.0.1 -U [[username]] -d [[dbname]] -n [[schemaname]]
The import begins to run, but it says:
pg_restore: error: could not execute query: ERROR: role "[[old_role]]" does not exist
Command was: ALTER TABLE [[schemaname]].[[tablename]] OWNER TO [[old_role]];
Seems as if the "-O"
approx. "--no-owner"
param above is completely ignored, despite of i called pg_dump as root and postgres user!?
Any ideas how to teach the pg_dump to do not export the “update role”-Statements?