Re: pg_dump schema in pg11 without global permissions

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Sergey Koposov <skoposov(at)cmu(dot)edu>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_dump schema in pg11 without global permissions
Date: 2019-07-23 22:21:39
Message-ID: 3c27ead3-134a-d27d-1097-684af2e6a811@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 7/23/19 3:19 PM, Sergey Koposov wrote:
> Hi,
>
> I'm trying to copy a schema from one PG database (ver 11) to PG 10.
> Previously the first database version was 9.6 and the way I did the copying was
>
> ssh -o Compression=no user(at)host '/opt/pgsql/bin/pg_dump --no-tablespaces -n schemaname -Fc  -U dbadmin dbname'  | pg_restore -U dbadmin -h localhost -1 -d dbnme
>
> However after migrating from PG 9.6 to 11, when I did the same thing as before, I started getting a bunch of commands in the dump like this
>
> GRANT CONNECT ON DATABASE dbname TO usernameXX;
>
> which don't work for me because the list of users is different between different machines.
> It is clear that the change is related to the way pg_dump is implemented now in PG11 that global objects are dumped.
> But the question is how do I duplicate the previous behaviour, i.e. Dump just the schema and permission on the schema, not on the database.

https://www.postgresql.org/docs/11/app-pgdump.html

-x
--no-privileges
--no-acl

Prevent dumping of access privileges (grant/revoke commands).

>
> I do know that I could grep the dump, but that's very annoying when dumping hundreds of millions of rows.
>
> Thanks in advance for the help.
>
>       Sergey
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sergey Koposov 2019-07-23 22:23:49 Re: pg_dump schema in pg11 without global permissions
Previous Message Sergey Koposov 2019-07-23 22:19:27 pg_dump schema in pg11 without global permissions