Re: Issue dumping schema using readonly user

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Daniel LaMotte <lamotte85(at)gmail(dot)com>, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Issue dumping schema using readonly user
Date: 2015-02-17 23:28:53
Message-ID: 13518.1424215733@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-general

Stephen Frost <sfrost(at)snowman(dot)net> writes:
> * Daniel LaMotte (lamotte85(at)gmail(dot)com) wrote:
>> I understand this. This is the behavior I want. What I don't understand
>> is why the readonly user can inspect the schema of the table interactively
>> when pg_dump refuses to do the same via the command line (assumably it asks
>> for too much permission when simply trying to dump the schema [NOT the
>> table data]).

> The issue is that pg_dump wants to lock the table against changes, which
> is really to prevent the table to change between "we got the definition
> of the table" and "pulling the records out of the table." It's not
> immediately obvious, to me at least, that there's really any need to
> lock the tables when doing a schema-only dump. Accesses to the catalogs
> should be consistent across the lifetime of the transaction which
> pg_dump is operating in and a schema-only dump isn't doing anything
> else.

This is the standard mistake about pg_dump, which is to imagine that it
depends only on userspace operations while inspecting schema info. It
doesn't; it makes use of things like ruleutils.c which operate on "latest
available data" rules. Accordingly, no we're not going to skip taking
the table locks. At least not without a ground-up rewrite of that whole
mess, which as you know has been discussed multiple times without anything
useful happening.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2015-02-17 23:35:40 Re: Revoking access for pg_catalog schema objects
Previous Message Stephen Frost 2015-02-17 23:19:42 Re: Issue dumping schema using readonly user