Re: pg_dump as a bunch of PostgreSQL functions - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pg_dump as a bunch of PostgreSQL functions
Date
Msg-id 6895.1095171573@sss.pgh.pa.us
Whole thread Raw
In response to pg_dump as a bunch of PostgreSQL functions  (Mark Gibson <gibsonm@cromwell.co.uk>)
Responses Re: pg_dump as a bunch of PostgreSQL functions  (Mark Gibson <gibsonm@cromwell.co.uk>)
List pgsql-hackers
Mark Gibson <gibsonm@cromwell.co.uk> writes:
> I have an idea, to break pg_dump into functions within PostgreSQL.

This strikes me as largely useless, because the problems that are 
actually hard for pg_dump are not at the level of individual objects;
they have to do with problems like determining a safe dump order and
altering definitions to break circularities in the dump requirements.
I don't think that extending the pg_get_xxx family of functions would
make pg_dump's life easier by any measurable amount.

There is also a fundamental problem with the current pg_get_xxx
functions, which is that they rely on backend-internal catalog
operations that generally use SnapshotNow semantics.  This is not what
we want to guarantee that pg_dump dumps a consistent snapshot --- we
need to look at catalog rows that existed as of pg_dump's serializable
snapshot, instead.  We have gotten away with it so far because pg_dump
starts by taking read locks on every table in sight, and that is
sufficient to block schema changes on the tables.  But extending the
pg_get_xxx approach to non-table-related objects would be seriously
dangerous.  (I think pg_get_viewdef is already broken, actually,
since you can't lock a view.)
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Merlin Moncure"
Date:
Subject: Re: libpq and prepared statements progress for 8.0
Next
From: strk
Date:
Subject: Re: pg_restore segfault with pg-CVS