Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z71zL-0005bF-5w for pgsql-bugs@arkaria.postgresql.org; Mon, 22 Jun 2015 13:42:15 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Z71zK-0003lV-Is for pgsql-bugs@arkaria.postgresql.org; Mon, 22 Jun 2015 13:42:14 +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.84) (envelope-from ) id 1Z71yW-000344-3i for pgsql-bugs@postgresql.org; Mon, 22 Jun 2015 13:41:24 +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.84) (envelope-from ) id 1Z71yL-0004Cd-Gk for pgsql-bugs@postgresql.org; Mon, 22 Jun 2015 13:41:22 +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 t5MDf7wG021747; Mon, 22 Jun 2015 09:41:08 -0400 From: Tom Lane To: gregburek@heroku.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #13458: postgres_fdw with usermapping dumped with pg_dump --no-owners results in dump file with implicit own In-reply-to: <20150622043337.3872.70054@wrigleys.postgresql.org> References: <20150622043337.3872.70054@wrigleys.postgresql.org> Comments: In-reply-to gregburek@heroku.com message dated "Mon, 22 Jun 2015 04:33:37 -0000" Date: Mon, 22 Jun 2015 09:41:07 -0400 Message-ID: <21746.1434980467@sss.pgh.pa.us> X-Pg-Spam-Score: -3.3 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org gregburek@heroku.com writes: > Reproduction schema: > CREATE SERVER redshift_dw FOREIGN DATA WRAPPER postgres_fdw OPTIONS ( > dbname 'reporting', > host 'example.com', > port '5439', > sslmode 'require' > ); > ALTER SERVER redshift_dw OWNER TO u5cuus46hhtdfs; > CREATE USER MAPPING FOR u5cuus46hhtdfs SERVER redshift_dw OPTIONS ( > password '', > "user" 'user' > ); > A pg_dump --no-acl --no-owner will reference the user: > -- > -- TOC entry 4313 (class 0 OID 0) > -- Dependencies: 2216 > -- Name: USER MAPPING u5cuus46hhtdfs SERVER redshift_dw; Type: USER MAPPING; > Schema: -; Owner: - > -- > CREATE USER MAPPING FOR u5cuus46hhtdfs SERVER redshift_dw OPTIONS ( > And a pg_restore --no-acl --no-owner will fail on this line as pg_restore is > using a different user: > pg_restore: [archiver (db)] Error from TOC entry 4491; 0 0 USER MAPPING USER > MAPPING u5cuus46hhtdfs SERVER redshift_dw u5cuus46hhtdfs > pg_restore: [archiver (db)] could not execute query: ERROR: role > "u5cuus46hhtdfs" does not exist > Command was: CREATE USER MAPPING FOR u5cuus46hhtdfs SERVER redshift_dw > OPTIONS ( This does not seem like a bug to me. The only thing we could really do to avoid the error is to decree that pg_restore should treat USER MAPPING objects as being suppressed altogether by --no-acl or --no-owner; and I'm doubtful that that would be an improvement. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs