pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
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
Date: Mon, 22 Jun 2015 09:41:07 -0400
Message-ID: <21746.1434980467@sss.pgh.pa.us> (raw)
In-Reply-To: <20150622043337.3872.70054@wrigleys.postgresql.org>
References: <20150622043337.3872.70054@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

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



view thread (2+ messages)

Message-ID: <21746.1434980467@sss.pgh.pa.us>
Permalink:  ../21746.1434980467@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/21746.1434980467@sss.pgh.pa.us

 · 

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-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, gregburek@heroku.com
  Subject: Re: BUG #13458: postgres_fdw with usermapping dumped with pg_dump --no-owners results in dump file with implicit own
  In-Reply-To: <21746.1434980467@sss.pgh.pa.us>
  References: <20150622043337.3872.70054@wrigleys.postgresql.org> <21746.1434980467@sss.pgh.pa.us>

* 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