pgsql: Support opfamily members in get_object_address

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Support opfamily members in get_object_address
Date: 2015-03-16 15:07:13
Message-ID: E1YXWbp-0006cW-W3@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

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

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/a61fd5334eb1040d0dcec0368702398a5b49152c

Modified Files
--------------
src/backend/catalog/objectaddress.c | 234 ++++++++++++++++++++------
src/backend/commands/dropcmds.c | 24 ++-
src/backend/commands/event_trigger.c | 2 +
src/backend/parser/gram.y | 43 ++---
src/include/nodes/parsenodes.h | 2 +
src/test/regress/expected/object_address.out | 60 ++++---
src/test/regress/sql/object_address.sql | 16 +-
7 files changed, 264 insertions(+), 117 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2015-03-16 20:41:15 Re: pgsql: Support opfamily members in get_object_address
Previous Message Tom Lane 2015-03-16 03:22:25 pgsql: Replace insertion sort in contrib/intarray with qsort().

Browse pgsql-hackers by date

  From Date Subject
Next Message Dean Rasheed 2015-03-16 15:10:26 Re: INSERT ... ON CONFLICT IGNORE (and UPDATE) 3.0
Previous Message Stephen Frost 2015-03-16 14:16:25 Re: One question about security label command