diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2015-04-06 11:40:55 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2015-04-06 11:40:55 -0300 |
commit | e9a077cad3799b41e8deef6fd8cb87e50164a791 (patch) | |
tree | 7f0794bc0faacc9eb8d62b1f5c07fd82790a1474 /src/backend/utils/cache/lsyscache.c | |
parent | 70dc2db7f1dfdecdacf595bf00964cb20ad5a835 (diff) | |
download | postgresql-e9a077cad3799b41e8deef6fd8cb87e50164a791.tar.gz postgresql-e9a077cad3799b41e8deef6fd8cb87e50164a791.zip |
pg_event_trigger_dropped_objects: add is_temp column
It now also reports temporary objects dropped that are local to the
backend. Previously we weren't reporting any temp objects because it
was deemed unnecessary; but as it turns out, it is necessary if we want
to keep close track of DDL command execution inside one session. Temp
objects are reported as living in schema pg_temp, which works because
such a schema-qualification always refers to the temp objects of the
current session.
Diffstat (limited to 'src/backend/utils/cache/lsyscache.c')
-rw-r--r-- | src/backend/utils/cache/lsyscache.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c index 818c2f619ba..6a398638906 100644 --- a/src/backend/utils/cache/lsyscache.c +++ b/src/backend/utils/cache/lsyscache.c @@ -19,6 +19,7 @@ #include "access/htup_details.h" #include "access/nbtree.h" #include "bootstrap/bootstrap.h" +#include "catalog/namespace.h" #include "catalog/pg_amop.h" #include "catalog/pg_amproc.h" #include "catalog/pg_collation.h" @@ -2884,6 +2885,20 @@ get_namespace_name(Oid nspid) return NULL; } +/* + * get_namespace_name_or_temp + * As above, but if it is this backend's temporary namespace, return + * "pg_temp" instead. + */ +char * +get_namespace_name_or_temp(Oid nspid) +{ + if (isTempNamespace(nspid)) + return "pg_temp"; + else + return get_namespace_name(nspid); +} + /* ---------- PG_RANGE CACHE ---------- */ /* |