Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

377
Views
Restore postgres schema from .sql dump file without role and/or permissions?

I receive the following error when attempting to restore a postgres database schema from an .sql dump file created on another server:

REVOKE psql:backup.sql:158885: ERROR: role "server_name" does not exist

The dump file was created using pg_dump -U username "server_name" -n schema_name > schema_name.sql

How can I create a dump file without role and/or permissions?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

By utilizing the flags --no-owner and --no-acl

Do not output commands to set ownership of objects to match the original database. By default, pg_restore issues ALTER OWNER or SET SESSION AUTHORIZATION statements to set ownership of created schema elements. These statements will fail unless the initial connection to the database is made by a superuser (or the same user that owns all of the objects in the script). With -O, any user name can be used for the initial connection, and this user will own all the created objects.

Prevent restoration of access privileges (grant/revoke commands):

pg_dump --no-owner --no-acl -U username "server_name" -n schema > schema.sql

https://www.postgresql.org/docs/9.2/static/app-pgrestore.html

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!