Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hq3ux-0003mU-LW for pgsql-general@arkaria.postgresql.org; Tue, 23 Jul 2019 23:09:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hq3uw-0002tm-HD for pgsql-general@arkaria.postgresql.org; Tue, 23 Jul 2019 23:09:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hq3uw-0002ra-4T for pgsql-general@lists.postgresql.org; Tue, 23 Jul 2019 23:09:58 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1hq3uo-0000fg-LZ for pgsql-general@lists.postgresql.org; Tue, 23 Jul 2019 23:09:56 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 7E65920F51; Tue, 23 Jul 2019 19:09:48 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 23 Jul 2019 19:09:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:from:to:cc:references:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=+ ucOYECXszuxJt8fRO5zU3CvKx/kND6E3RjQTgu1ARY=; b=q/Yr7oTRodu9f6jGr 7erpEhfdKHzKT+KPqZ3jID/33rnIT9ZB5f1l8vHTZgrmyQZ8TR/Whb7WtLLtSGly Ao44MxIsTXjiFFkJKKyO/k6LFSwJyBDaqQK6GsLmwU4dn/deNFYezD7PiqKxcgZj DckDrvuK+j4aUHSPFQz7Q4pjrkdYab+s3piRgU87xdvIyPJN2KmEDrWnlb4V4uHg r5Y4I+PY2ziiAU521ZPVgBiDVVz74Asuy4hKNlByCM60QFx41DCa54G9WUDPMxVL yxvCgKZXR6ccGw1jmZgUUqFZh2N7TFaKO+2A1MxjCW6DHU+1ONeAkoToFJy1LaaR a2B4w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=+ucOYECXszuxJt8fRO5zU3CvKx/kND6E3RjQTgu1A RY=; b=1Cq3G4pt483ZUqBpyWuHJduTF8LiOPiU3tdITL7mxz8Ig+90VeM/i8fcg xQNqOMNuWOWPcbu5GNyKIrBwl65JrTREbwmFGuAtHORGvO7/E9A2Lwe1O9lyfRJi MEhIjmzWqoW8c2XtS1A0BF3ycH4DD0iLiIZsWhjJgT3cIqvemONK7Vx5sBXDBODw wfPD/WeTnJrQtqAyokAIcFT64Q6WxuuqlV9WVbJWT54uf/DJLMBxFsp8Xw8ve0Ir FG/lUKjGKLHSJaCqbw1cLuj2/I0UBMPFNxz60AXvxBiSrLmOsh0pYtQpLs8URmat 4si+FjLgCQnsbbwqVZLWxGNnbtR9w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrjeelgddukecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuhffvfhfkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecuffhomhgrihhnpehpohhsthhgrhgvshhqlhdrohhrghenucfkphepjeefrddvfeel rdduudejrddvfeeknecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrg hvvghrsegrkhhlrghvvghrrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from ranger.suse (c-73-239-117-238.hsd1.wa.comcast.net [73.239.117.238]) by mail.messagingengine.com (Postfix) with ESMTPA id 736C2380084; Tue, 23 Jul 2019 19:09:47 -0400 (EDT) Subject: Re: pg_dump schema in pg11 without global permissions From: Adrian Klaver To: Sergey Koposov Cc: "pgsql-general@lists.postgresql.org" References: <1563920367.29206.91.camel@cmu.edu> <3c27ead3-134a-d27d-1097-684af2e6a811@aklaver.com> <1563920629.29206.93.camel@cmu.edu> <1563921764.29206.97.camel@cmu.edu> <1563922734.29206.103.camel@cmu.edu> <7bc24eb3-40a7-f402-db03-3b9c00eb1751@aklaver.com> Message-ID: <2e5daafe-3d25-5d4c-5d73-dabbffc6422e@aklaver.com> Date: Tue, 23 Jul 2019 16:09:46 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <7bc24eb3-40a7-f402-db03-3b9c00eb1751@aklaver.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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