Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

378
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda