Re: Refactor pg_dump as a library?

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Andreas Karlsson <andreas(at)proxel(dot)se>, Craig Ringer <craig(at)2ndquadrant(dot)com>, Jakob Egger <jakob(at)eggerapps(dot)at>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Refactor pg_dump as a library?
Date: 2016-04-14 16:42:52
Message-ID: 570FC88C.6040507@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 4/14/16 6:16 AM, Andreas Karlsson wrote:
> On 04/14/2016 12:22 PM, Craig Ringer wrote:
>> I'd find a pg_get_tabledef(...) built-in function more interesting for
>> this particular purpose than pg_dump as a library would be. We already
>> have pg_get_viewdef(...), pg_get_functiondef(...) etc.
>
> I am personally not a fan of the pg_get_Xdef() functions due to their
> heavy reliance on the syscache which feels rather unsafe in combination
> with concurrent DDL. I would not be surprised if we have some low
> probability bugs which cause inconsistent backups there which just has
> not hit enough people yet to have been reported. And this problem will
> only get worse as we reduce the lock level of more DDL.

The other issue specific to pg_dump is it often needs to do something
different than what pg_get_*def would do to support version upgrades.

I agree that it would be nice to have better DDL generation capabilities
in the database, but I think the right way to do that is to create the
pg_dump library and then wrap that as a (version-specific) extension.
That way you could loan the pg_dump-9.5 extension in a 9.3 database if
you wanted.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2016-04-14 16:59:49 Re: Pglogical questions and problems
Previous Message Tom Lane 2016-04-14 16:28:43 Broken API specification for walrcv_receive