Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fdjkd-0001v7-3i for pgsql-bugs@arkaria.postgresql.org; Thu, 12 Jul 2018 22:07:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fdjkZ-0000iX-91 for pgsql-bugs@arkaria.postgresql.org; Thu, 12 Jul 2018 22:07:47 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fdjkY-0000iQ-W5 for pgsql-bugs@lists.postgresql.org; Thu, 12 Jul 2018 22:07:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fdjkW-0004Zx-1W for pgsql-bugs@postgresql.org; Thu, 12 Jul 2018 22:07:45 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w6CM7gnp012530; Thu, 12 Jul 2018 18:07:42 -0400 From: Tom Lane To: Moshe Jacobson cc: Postgres-Bugs Subject: Re: pg_restore: All GRANTs on table fail when any one role is missing In-reply-to: References: Comments: In-reply-to Moshe Jacobson message dated "Thu, 12 Jul 2018 15:48:04 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <12528.1531433262.1@sss.pgh.pa.us> Date: Thu, 12 Jul 2018 18:07:42 -0400 Message-ID: <12529.1531433262@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Moshe Jacobson writes: > I take a backup using pg_dump -Fc, and then restore on the second cluster > (where "user1" does not exist). > The restore process says it ignored the error for the missing user, but the > restored table now has no perms at all. Not even for user public. > Examining pg_restore sql output shows two separate grant commands, however > the problem persists even if I pipe pg_restore output into psql. Very > strange. Hm. I can understand why this would happen if you do pg_restore direct to the server: the GRANTs will all be part of the same "TOC entry" in the dump file, and I'm pretty sure pg_restore issues the entire contents of a TOC entry in one PQexec, so that it's effectively a single transaction. However, if you tell pg_restore to emit text and then pass the text to psql, each SQL command should be processed separately. Are you sure about the failure still occurring in that case? regards, tom lane