PostgreSQL 9.1 pg_restore error regarding PLPGSQL

前端 未结 6 1494
-上瘾入骨i
-上瘾入骨i 2020-12-23 02:30

I am using Postgres for a django project and I am currently implementing a database backup/restore system that as simple as possible performs a pg_dump when the user clicks

6条回答
  •  不思量自难忘°
    2020-12-23 02:53

    I found the following workaround on this page:

    http://archives.postgresql.org/pgsql-general/2011-10/msg00826.php

    The idea is to use pg_restore -l to list the contents of the archive, grep out the extension that the user doesn't have permission to restore, and use pg_restore -L to use this elided list when restoring.

    For example:

    pg_restore -l ~/database.dump | grep -v "EXTENSION - plpgsql" > ~/restore_elements
    pg_restore -L ~/restore_elements ~/database.dump
    

提交回复
热议问题