I want to take a backup from my postgresql db which I use for my Django project.

I'm using ubuntu 18.04 and want to import it in AWS lightsail.

I read pgadmin docs on how to take a backup with a definition for each option item under Dump options.

But I don't know what options should be yes or no for restoring this db when I want to deploy my project on AWS lightsail.

I took a backup with custom format and UTF8 encoding with postgres role name from my db. under dump options I selected following options:

  • pre-data yes
  • data yes
  • post-data yes
  • blobs yes
  • comments yes
  • user column inserts yes
  • use insert commands yes
  • include create database statement yes
  • include drop database statement yes
  • qouting yes
  • verbose messages yes

When I want to restore it in a db in AWS lightsail I get the following error for some tables:

Running command:

/usr/bin/pg_restore --host "blah-blah-blah" --port "5432" --username "dbmasteruser" --no-password --dbname "cms_restore" --verbose "/home/shahriar/cmsproject_backup.txt"

pg_restore: error: could not execute query: ERROR:  role "postgres" does not exist
Command was: ALTER TABLE public.auth_permission_id_seq OWNER TO postgres;

Failed (exit code: 1).

But when I check the db in AWS I see my data in pgadmin.

What is wrong with the backing-up process or restoring process?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.