diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2013-03-20 18:19:19 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2013-03-20 18:19:19 -0300 |
commit | f8348ea32ec8d713cd6e5d5e16f15edef22c4d03 (patch) | |
tree | b29bf3aef75a8927e7e9d889bef6786984a058c0 /src/include | |
parent | a7921f71a3c747141344d8604f6a6d7b4cddb2a9 (diff) | |
download | postgresql-f8348ea32ec8d713cd6e5d5e16f15edef22c4d03.tar.gz postgresql-f8348ea32ec8d713cd6e5d5e16f15edef22c4d03.zip |
Allow extracting machine-readable object identity
Introduce pg_identify_object(oid,oid,int4), which is similar in spirit
to pg_describe_object but instead produces a row of machine-readable
information to uniquely identify the given object, without resorting to
OIDs or other internal representation. This is intended to be used in
the event trigger implementation, to report objects being operated on;
but it has usefulness of its own.
Catalog version bumped because of the new function.
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/catalog/catversion.h | 2 | ||||
-rw-r--r-- | src/include/catalog/dependency.h | 3 | ||||
-rw-r--r-- | src/include/catalog/objectaddress.h | 13 | ||||
-rw-r--r-- | src/include/catalog/pg_proc.h | 3 | ||||
-rw-r--r-- | src/include/utils/builtins.h | 4 |
5 files changed, 20 insertions, 5 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index db0776e24d1..cbc4673d1b4 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 201303141 +#define CATALOG_VERSION_NO 201303201 #endif diff --git a/src/include/catalog/dependency.h b/src/include/catalog/dependency.h index 8e0837f7d61..3aefbb5e6a9 100644 --- a/src/include/catalog/dependency.h +++ b/src/include/catalog/dependency.h @@ -176,9 +176,6 @@ extern void recordDependencyOnSingleRelExpr(const ObjectAddress *depender, extern ObjectClass getObjectClass(const ObjectAddress *object); -extern char *getObjectDescription(const ObjectAddress *object); -extern char *getObjectDescriptionOids(Oid classid, Oid objid); - extern ObjectAddresses *new_object_addresses(void); extern void add_exact_object_address(const ObjectAddress *object, diff --git a/src/include/catalog/objectaddress.h b/src/include/catalog/objectaddress.h index ffaf4ea25a1..2f8f58da9bc 100644 --- a/src/include/catalog/objectaddress.h +++ b/src/include/catalog/objectaddress.h @@ -38,6 +38,7 @@ extern void check_object_ownership(Oid roleid, extern Oid get_object_namespace(const ObjectAddress *address); +extern bool is_objectclass_supported(Oid class_id); extern Oid get_object_oid_index(Oid class_id); extern int get_object_catcache_oid(Oid class_id); extern int get_object_catcache_name(Oid class_id); @@ -46,5 +47,15 @@ extern AttrNumber get_object_attnum_namespace(Oid class_id); extern AttrNumber get_object_attnum_owner(Oid class_id); extern AttrNumber get_object_attnum_acl(Oid class_id); extern AclObjectKind get_object_aclkind(Oid class_id); +extern bool get_object_namensp_unique(Oid class_id); -#endif /* PARSE_OBJECT_H */ +extern HeapTuple get_catalog_object_by_oid(Relation catalog, + Oid objectId); + +extern char *getObjectDescription(const ObjectAddress *object); +extern char *getObjectDescriptionOids(Oid classid, Oid objid); + +extern char *getObjectTypeDescription(const ObjectAddress *object); +extern char *getObjectIdentity(const ObjectAddress *address); + +#endif /* OBJECTADDRESS_H */ diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index c97056e1673..4aee00233a9 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -2917,6 +2917,9 @@ DESCR("view members of a multixactid"); DATA(insert OID = 3537 ( pg_describe_object PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 25 "26 26 23" _null_ _null_ _null_ _null_ pg_describe_object _null_ _null_ _null_ )); DESCR("get identification of SQL object"); +DATA(insert OID = 3839 ( pg_identify_object PGNSP PGUID 12 1 0 0 0 f f f f t f s 3 0 2249 "26 26 23" "{26,23,23,25,25,25,25}" "{i,i,i,o,o,o,o}" "{classid,objid,subobjid,type,schema,name,identity}" _null_ pg_identify_object _null_ _null_ _null_ )); +DESCR("get machine-parseable identification of SQL object"); + DATA(insert OID = 2079 ( pg_table_is_visible PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_table_is_visible _null_ _null_ _null_ )); DESCR("is table visible in search path?"); DATA(insert OID = 2080 ( pg_type_is_visible PGNSP PGUID 12 10 0 0 0 f f f f t f s 1 0 16 "26" _null_ _null_ _null_ _null_ pg_type_is_visible _null_ _null_ _null_ )); diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index c0debe400c4..cd8ac9462b5 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -615,7 +615,9 @@ extern Datum regdictionarysend(PG_FUNCTION_ARGS); extern Datum text_regclass(PG_FUNCTION_ARGS); extern List *stringToQualifiedNameList(const char *string); extern char *format_procedure(Oid procedure_oid); +extern char *format_procedure_qualified(Oid procedure_oid); extern char *format_operator(Oid operator_oid); +extern char *format_operator_qualified(Oid operator_oid); /* rowtypes.c */ extern Datum record_in(PG_FUNCTION_ARGS); @@ -1027,6 +1029,7 @@ extern Datum pg_encoding_max_length_sql(PG_FUNCTION_ARGS); /* format_type.c */ extern Datum format_type(PG_FUNCTION_ARGS); extern char *format_type_be(Oid type_oid); +extern char *format_type_be_qualified(Oid type_oid); extern char *format_type_with_typemod(Oid type_oid, int32 typemod); extern Datum oidvectortypes(PG_FUNCTION_ARGS); extern int32 type_maximum_size(Oid type_oid, int32 typemod); @@ -1143,6 +1146,7 @@ extern Datum pg_get_multixact_members(PG_FUNCTION_ARGS); /* catalogs/dependency.c */ extern Datum pg_describe_object(PG_FUNCTION_ARGS); +extern Datum pg_identify_object(PG_FUNCTION_ARGS); /* commands/constraint.c */ extern Datum unique_key_recheck(PG_FUNCTION_ARGS); |