How to solve privileges issues when restore PostgreSQL Database

前端 未结 10 1980
Happy的楠姐
Happy的楠姐 2020-12-12 16:19

I have dumped a clean, no owner backup for Postgres Database with the command

pg_dump sample_database -O -c -U

Later, when I restore the databas

10条回答
  •  执念已碎
    2020-12-12 16:29

    For people who have narrowed down the issue to the COMMENT ON statements (as per various answers below) and who have superuser access to the source database from which the dump file is created, the simplest solution might be to prevent the comments from being included to the dump file in the first place, by removing them from the source database being dumped...

    COMMENT ON EXTENSION postgis IS NULL;
    COMMENT ON EXTENSION plpgsql IS NULL;
    COMMENT ON SCHEMA public IS NULL;
    

    Future dumps then won't include the COMMENT ON statements.

提交回复
热议问题