Jim Nasby wrote:

> 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).

> 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?

I suppose it's because your use case is different than the one I was
trying to satisfy, so we have different ideas on what is necessary.

> 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.

Yeah, this info is available in the pg_ddl_command object, but you need
to write some C code to get to it, as the structs are specific to each
possible command.  I suppose we could have written another function such
as the one with have for drops (pg_event_trigger_dropped_objects).  As
far as I can tell we don't have any commands that rename more than one
object at a time, so it would be simpler, but I don't know how likely
that is to change.

Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:

Reply via email to