SwapSQL

Migration errors

Fix: role "xyz" does not exist when importing a PostgreSQL dump

ERROR: role "shopadmin" does not exist

When it happens

Restoring a pg_dump file on a different server.

Why it happens

Dumps contain ALTER … OWNER TO and GRANT statements referencing roles from the source server, which don't exist on the target.

How to fix it

1. Skip ownership at dump time

pg_dump --no-owner --no-privileges mydb > dump.sql

2. Or at restore time (custom format)

pg_restore --no-owner --no-privileges -d mydb dump.dump

3. Converting MySQL → PostgreSQL with us?

Output is generated with --no-owner --no-privileges, so it restores cleanly under any user.

Migrating between MySQL and PostgreSQL?

Our converter handles this and dozens of other gotchas automatically — upload a dump, download working SQL.

Try the converter free

More: all migration guides & error fixes