diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2015-03-16 12:06:34 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2015-03-16 12:06:34 -0300 |
commit | a61fd5334eb1040d0dcec0368702398a5b49152c (patch) | |
tree | b7976f69848c8b072cef4104208e5834ec4d93b2 /src/backend/commands/dropcmds.c | |
parent | 8d1f239003d0245dda636dfa6cf0add13bee69d6 (diff) | |
download | postgresql-a61fd5334eb1040d0dcec0368702398a5b49152c.tar.gz postgresql-a61fd5334eb1040d0dcec0368702398a5b49152c.zip |
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
Diffstat (limited to 'src/backend/commands/dropcmds.c')
-rw-r--r-- | src/backend/commands/dropcmds.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/backend/commands/dropcmds.c b/src/backend/commands/dropcmds.c index e5185ba34d2..a1b0d4d2fa2 100644 --- a/src/backend/commands/dropcmds.c +++ b/src/backend/commands/dropcmds.c @@ -406,19 +406,27 @@ does_not_exist_skipping(ObjectType objtype, List *objname, List *objargs) name = NameListToString(objname); break; case OBJECT_OPCLASS: - if (!schema_does_not_exist_skipping(objname, &msg, &name)) { - msg = gettext_noop("operator class \"%s\" does not exist for access method \"%s\", skipping"); - name = NameListToString(objname); - args = strVal(linitial(objargs)); + List *opcname = list_copy_tail(objname, 1); + + if (!schema_does_not_exist_skipping(opcname, &msg, &name)) + { + msg = gettext_noop("operator class \"%s\" does not exist for access method \"%s\", skipping"); + name = NameListToString(opcname); + args = strVal(linitial(objname)); + } } break; case OBJECT_OPFAMILY: - if (!schema_does_not_exist_skipping(objname, &msg, &name)) { - msg = gettext_noop("operator family \"%s\" does not exist for access method \"%s\", skipping"); - name = NameListToString(objname); - args = strVal(linitial(objargs)); + List *opfname = list_copy_tail(objname, 1); + + if (!schema_does_not_exist_skipping(opfname, &msg, &name)) + { + msg = gettext_noop("operator family \"%s\" does not exist for access method \"%s\", skipping"); + name = NameListToString(opfname); + args = strVal(linitial(objname)); + } } break; default: |