Skip site navigation (1) Skip section navigation (2)

Re: BUG #5560: pg_dump generates invalid DDL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Shigeru Hanada" <hanada(at)metrosystems(dot)co(dot)jp>
Cc: pgsql-bugs(at)postgresql(dot)org, Peter Eisentraut <peter_e(at)gmx(dot)net>
Subject: Re: BUG #5560: pg_dump generates invalid DDL
Date: 2010-07-13 22:31:22
Message-ID: 18612.1279060282@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
"Shigeru Hanada" <hanada(at)metrosystems(dot)co(dot)jp> writes:
> When target database contains user mapping for public, pg_dump generates
> invalid DDL with empty string like this.

> CREATE USER MAPPING FOR "" SERVER srv;

I can reproduce this behavior.

Another serious problem with the pg_dump code for user mappings is that
it fails outright if the user is not superuser --- meaning that that
patch has completely broken non-superuser use of pg_dump.  That's
entirely unacceptable IMO.

The simplest fix seems to be to have pg_dump look at 
the pg_user_mappings view rather than directly at pg_user_mapping.
That both provides the special case for PUBLIC and gets around the
permissions problem.  It does mean that user mappings will be silently
dumped without the options data if you don't have privileges for the
specific mapping, but ISTM that beats failing entirely.  (Alternatively,
we could probably persuade pg_dump to not dump mappings the caller
hasn't got permissions for ... is that better?)

Peter, any comments?

			regards, tom lane

In response to

pgsql-bugs by date

Next:From: Jaime CasanovaDate: 2010-07-14 00:39:40
Subject: Re: BUG #5557: Problema com Bytea
Previous:From: Tom LaneDate: 2010-07-13 22:16:03
Subject: Re: BUG #5561: Tsearch across schemas

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group