Re: References to arbitrary database objects that are suitable for pg_dump

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Subject: Re: References to arbitrary database objects that are suitable for pg_dump
Date: 2016-12-11 00:14:32
Message-ID: bc889610-5571-78d3-e4c5-f9e36141fac0@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/26/16 12:30 AM, Jim Nasby wrote:
> On 11/25/16 6:00 PM, Tom Lane wrote:
>> OIDs? Then use pg_describe_object() to turn that into text when dumping.
>
> How would I get pg_dump to do that?
>
> I could certainly make this work if there was some way to customize how
> pg_dump dumps things, but AFAIK there's no way to do that, even with
> extensions.

Is there anything that will translate an object identity (as returned by
pg_event_trigger_ddl_commands) into class/object/subobject OIDs? If I
had that, I could use it to track objects by OID (like pg_depend does),
as well as storing the text representation. That way I can have an event
trigger that updates the stored pg_describe_object() text any time an
object was renamed. Without that, I don't see any good way to find the
original name of a renamed object (so that I can update my reference to it).

ISTM it would be useful to add address_names and address_args to
pg_event_trigger_ddl_commands(), as well as adding some way to get the
original information for an object when an ALTER is being done. In
particular, if something (such as a column) is being renamed.

BTW, why were pg_get_object_address and pg_identify_object_as_address
added instead of creating a function that accepted the output of
pg_identify_object()? Is there a reason that wouldn't work?
--
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
855-TREBLE2 (855-873-2532)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-12-11 00:46:35 Re: Effect of caching hash bucket size while costing
Previous Message Andrew Dunstan 2016-12-11 00:06:40 jacana hung after failing to acquire random number