pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Sergey Koposov <skoposov@cmu.edu>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: pg_dump schema in pg11 without global permissions
Date: Tue, 23 Jul 2019 16:09:46 -0700
Message-ID: <2e5daafe-3d25-5d4c-5d73-dabbffc6422e@aklaver.com> (raw)
In-Reply-To: <7bc24eb3-40a7-f402-db03-3b9c00eb1751@aklaver.com>
References: <1563920367.29206.91.camel@cmu.edu>
	<3c27ead3-134a-d27d-1097-684af2e6a811@aklaver.com>
	<1563920629.29206.93.camel@cmu.edu>
	<eb0004eb-e415-7320-ad6b-fc36c49c3518@aklaver.com>
	<1563921764.29206.97.camel@cmu.edu>
	<bde193d8-ebeb-502b-2801-e347e4557197@aklaver.com>
	<1563922734.29206.103.camel@cmu.edu>
	<7bc24eb3-40a7-f402-db03-3b9c00eb1751@aklaver.com>

On 7/23/19 4:04 PM, Adrian Klaver wrote:
> On 7/23/19 3:58 PM, Sergey Koposov wrote:
>> On Tue, 2019-07-23 at 15:52 -0700, Adrian Klaver wrote:
>>> On 7/23/19 3:42 PM, Sergey Koposov wrote:
>>>>
>>>> On Tue, 2019-07-23 at 15:37 -0700, Adrian Klaver wrote:
>>>>>
>>>>> On 7/23/19 3:23 PM, Sergey Koposov wrote:
>>>>>>
>>>>>>
>>>>>> On Tue, 2019-07-23 at 15:21 -0700, Adrian Klaver wrote:
>>>>>>>
>>>>>>>
>>>>>>> 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@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).
>>>>>> Yes I saw that, but that will not dump privileges on the schema 
>>>>>> itself, which were dumped before as far as I understand ...
>>>>> So the roles for the schema don't change, but everything else does?
>>>> The schema permissions are granted to a generic user 'dbuser'. And a 
>>>> bunch of users are members of this role and that's how they access 
>>>> the schema.
>>>> The database permissions on the other hand are granted specifically 
>>>> per individual user.
>>> What version of pg_dump are you using?
>>>
>>> When I dump a version 10 database using a version 11 pg_dump I do not
>>> see: GRANT CONNECT ON DATABASE
>>>
>>> pg_dump -Fc -n utility  -s -d production -U postgres -p 5422 -f
>>> schema_test.out
>>>
>>> pg_restore -f schema_test_fc.sql schema_test.out
>>
>> I'm dumping version 11 database using version 11 pg_dump. I double 
>> checked this.
>>
>> I don't know if in your test-case you have custom users whom you 
>> granted connect permissions. I do have them.
>> Also what I'm seeing matches perfectly the release notes on pgdump 
>> which explicitely mention dumping of the global properties.
>>   https://www.postgresql.org/docs/11/release-11.html#id-1.11.6.9.4
> 
> That is only supposed to happen if you use -C(--create) and I am seeing 
                                                                    ^not
> that in your examples.
> 
>>
>>
>>         S
>>
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (14+ messages)  latest in thread

Message-ID: <2e5daafe-3d25-5d4c-5d73-dabbffc6422e@aklaver.com>
Permalink:  ../2e5daafe-3d25-5d4c-5d73-dabbffc6422e@aklaver.com/
Also on:    postgresql.org/message-id/2e5daafe-3d25-5d4c-5d73-dabbffc6422e@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, skoposov@cmu.edu
  Subject: Re: pg_dump schema in pg11 without global permissions
  In-Reply-To: <2e5daafe-3d25-5d4c-5d73-dabbffc6422e@aklaver.com>
  References: <1563920367.29206.91.camel@cmu.edu> <3c27ead3-134a-d27d-1097-684af2e6a811@aklaver.com> <1563920629.29206.93.camel@cmu.edu> <eb0004eb-e415-7320-ad6b-fc36c49c3518@aklaver.com> <1563921764.29206.97.camel@cmu.edu> <bde193d8-ebeb-502b-2801-e347e4557197@aklaver.com> <1563922734.29206.103.camel@cmu.edu> <7bc24eb3-40a7-f402-db03-3b9c00eb1751@aklaver.com> <2e5daafe-3d25-5d4c-5d73-dabbffc6422e@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox