diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2014-12-19 15:00:45 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2014-12-19 15:00:45 -0300 |
commit | 0ee98d1cbf1cd3b888633b2ee90e0001889c12b9 (patch) | |
tree | edf24dba8ab9d9a08e4a5b138de36b07f5e4c0ee /src/backend/commands/event_trigger.c | |
parent | 5c805d0a813e6c611485bfc9bde9d2a10d1800e5 (diff) |
pg_event_trigger_dropped_objects: add behavior flags
Add "normal" and "original" flags as output columns to the
pg_event_trigger_dropped_objects() function. With this it's possible to
distinguish which objects, among those listed, need to be explicitely
referenced when trying to replicate a deletion.
This is necessary so that the list of objects can be pruned to the
minimum necessary to replicate the DROP command in a remote server that
might have slightly different schema (for instance, TOAST tables and
constraints with different names and such.)
Catalog version bumped due to change of function definition.
Reviewed by: Abhijit Menon-Sen, Stephen Frost, Heikki Linnakangas,
Robert Haas.
Diffstat (limited to 'src/backend/commands/event_trigger.c')
-rw-r--r-- | src/backend/commands/event_trigger.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/backend/commands/event_trigger.c b/src/backend/commands/event_trigger.c index 6fb4817845c..8b88ecb359e 100644 --- a/src/backend/commands/event_trigger.c +++ b/src/backend/commands/event_trigger.c @@ -117,6 +117,8 @@ typedef struct SQLDropObject const char *objname; const char *objidentity; const char *objecttype; + bool original; + bool normal; slist_node next; } SQLDropObject; @@ -1238,7 +1240,7 @@ trackDroppedObjectsNeeded(void) * Register one object as being dropped by the current command. */ void -EventTriggerSQLDropAddObject(ObjectAddress *object) +EventTriggerSQLDropAddObject(const ObjectAddress *object, bool original, bool normal) { SQLDropObject *obj; MemoryContext oldcxt; @@ -1257,6 +1259,8 @@ EventTriggerSQLDropAddObject(ObjectAddress *object) obj = palloc0(sizeof(SQLDropObject)); obj->address = *object; + obj->original = original; + obj->normal = normal; /* * Obtain schema names from the object's catalog tuple, if one exists; @@ -1384,8 +1388,8 @@ pg_event_trigger_dropped_objects(PG_FUNCTION_ARGS) { SQLDropObject *obj; int i = 0; - Datum values[7]; - bool nulls[7]; + Datum values[9]; + bool nulls[9]; obj = slist_container(SQLDropObject, next, iter.cur); @@ -1401,6 +1405,12 @@ pg_event_trigger_dropped_objects(PG_FUNCTION_ARGS) /* objsubid */ values[i++] = Int32GetDatum(obj->address.objectSubId); + /* original */ + values[i++] = BoolGetDatum(obj->original); + + /* normal */ + values[i++] = BoolGetDatum(obj->normal); + /* object_type */ values[i++] = CStringGetTextDatum(obj->objecttype); |