Support opfamily members in get_object_address
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Mon, 16 Mar 2015 15:06:34 +0000 (12:06 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Mon, 16 Mar 2015 15:06:34 +0000 (12:06 -0300)
commita61fd5334eb1040d0dcec0368702398a5b49152c
treeb7976f69848c8b072cef4104208e5834ec4d93b2
parent8d1f239003d0245dda636dfa6cf0add13bee69d6
Support opfamily members in get_object_address

In the spirit of 890192e99af and 4464303405f: have get_object_address
understand individual pg_amop and pg_amproc objects.  There is no way to
refer to such objects directly in the grammar -- rather, they are almost
always considered an integral part of the opfamily that contains them.
(The only case that deals with them individually is ALTER OPERATOR
FAMILY ADD/DROP, which carries the opfamily address separately and thus
does not need it to be part of each added/dropped element's address.)
In event triggers it becomes possible to become involved with individual
amop/amproc elements, and this commit enables pg_get_object_address to
do so as well.

To make the overall coding simpler, this commit also slightly changes
the get_object_address representation for opclasses and opfamilies:
instead of having the AM name in the objargs array, I moved it as the
first element of the objnames array.  This enables the new code to use
objargs for the type names used by pg_amop and pg_amproc.

Reviewed by: Stephen Frost
src/backend/catalog/objectaddress.c
src/backend/commands/dropcmds.c
src/backend/commands/event_trigger.c
src/backend/parser/gram.y
src/include/nodes/parsenodes.h
src/test/regress/expected/object_address.out
src/test/regress/sql/object_address.sql