These are tools that make it easier to interface with the Postgres catalog tables/views/functions. They are meant for use by code, not by people.
To make use of them, you need to grant cat_tools__usage to any roles that need access.
This is very much a work in progress. If it doesn’t do something you need, please open an issue!
cat_tools.object_type- Descriptive names for every type of Postgres object (table, operator, rule, etc)cat_tools.constraint_type- Types of constraints (domain constraintortable_constraint)cat_tools.relation_type- Types of objects stored inpg_classcat_tools.relation_relkind- Valid values forpg_class.relkind
cat_tools.currval(table, column)- Returns current value for a sequence owned by a columncat_tools.enum_range(regtype)- Returns valid values for an ENUM as an arraycat_tools.enum_range_srf(regtype)- Returns valid values for an ENUM as a recordsetcat_tools.name__check(text)- Throws an error if input would be truncated when cast to namecat_tools.pg_class(relation regclass)- Returns cat_tools.pg_class_v row for a relationcat_tools.pg_extension__get(extension_name name)- Returns cat_tools.pg_extension_v row for an extensioncat_tools.extension__schemas(extension_names text/name[])- Returns the schemas for the requested functionscat_tools.extension__schemas_unique(extension_names text/name[])- Returns a unique array of schemascat_tools.function__arg_types(arguments)- Accepts full function argument string and returns regtype[] of IN/INOUT argumentscat_tools.functionarg_types_text(arguments)- Version offunctionarg_typesthat returns textcat_tools.object__catalog(object_type)- Returns catalog table that is used to storeobject_typeobjectscat_tools.object__reg_type(object_catalog)- Returns the "reg" pseudotype (ie: regclass) associated with a system catalog (ie: pg_class)cat_tools.regprocedure(function_name, arguments)- Returns regprocedure for function_name and it’s full set of argumentscat_tools.relation__kind(relkind)- Mapping frompg_class.relkindto acat_tools.relation_typecat_tools.relation__relkind(relation_type)- Mapping fromcat_tools.relation_typeto apg_class.relkindvaluecat_tools.triggerargs_as_text(text)- Converts the arguments for a trigger function (as returned bytriggerparse()) to text (for backwards compatibility).cat_tools.trigger__get_oid(trigger_table, trigger_name)- oid of a trigger. Throws error if trigger doesn’t exits.cat_tools.triggerget_oidloose(trigger_table, trigger_name)- oid of a trigger. Does not throw error if trigger doesn’t exits.cat_tools.trigger__parse(trigger oid)- Returns information about a triggercat_tools.trigger__parse(table_name regclass, trigger_name text)- Returns information about a trigger
Warning | These views may eventually move into a separate extension! |
cat_tools.pg_class_v- Joins pg_class to pg_namespacecat_tools.pg_extension_v- Joins pg_extension to pg_namespace; cast extconfig to regclass[]cat_tools.column- Returns data about columnscat_tools.pg_all_foreign_keys- Data about foreign keys
Cat Tools is released under a MIT license.
Copyright (c) 2016 Jim Nasby <[email protected]>.
