mirror of
https://github.com/postgres/postgres.git
synced 2025-12-10 14:22:35 +03:00
Fix pg_identify_object_as_address() with event triggers
Attempting to use this function with event triggers failed, as, since
its introduction in a676201, this code has never associated an object
name with event triggers. This addresses the failure by adding the
event trigger name to the set defining its object address.
Note that regression tests are added within event_trigger and not
object_address to avoid issues with concurrent connections in parallel
schedules.
Author: Joel Jacobson
Discussion: https://postgr.es/m/3c905e77-a026-46ae-8835-c3f6cd1d24c8@www.fastmail.com
Backpatch-through: 9.6
This commit is contained in:
@@ -4945,10 +4945,7 @@ getObjectIdentityParts(const ObjectAddress *object,
|
||||
{
|
||||
HeapTuple tup;
|
||||
Form_pg_event_trigger trigForm;
|
||||
|
||||
/* no objname support here */
|
||||
if (objname)
|
||||
*objname = NIL;
|
||||
char *evtname;
|
||||
|
||||
tup = SearchSysCache1(EVENTTRIGGEROID,
|
||||
ObjectIdGetDatum(object->objectId));
|
||||
@@ -4956,8 +4953,10 @@ getObjectIdentityParts(const ObjectAddress *object,
|
||||
elog(ERROR, "cache lookup failed for event trigger %u",
|
||||
object->objectId);
|
||||
trigForm = (Form_pg_event_trigger) GETSTRUCT(tup);
|
||||
appendStringInfoString(&buffer,
|
||||
quote_identifier(NameStr(trigForm->evtname)));
|
||||
evtname = NameStr(trigForm->evtname);
|
||||
appendStringInfoString(&buffer, quote_identifier(evtname));
|
||||
if (objname)
|
||||
*objname = list_make1(evtname);
|
||||
ReleaseSysCache(tup);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user