| 1 | /*------------------------------------------------------------------------- |
| 2 | * |
| 3 | * defrem.h |
| 4 | * POSTGRES define and remove utility definitions. |
| 5 | * |
| 6 | * |
| 7 | * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group |
| 8 | * Portions Copyright (c) 1994, Regents of the University of California |
| 9 | * |
| 10 | * src/include/commands/defrem.h |
| 11 | * |
| 12 | *------------------------------------------------------------------------- |
| 13 | */ |
| 14 | #ifndef DEFREM_H |
| 15 | #define DEFREM_H |
| 16 | |
| 17 | #include "catalog/objectaddress.h" |
| 18 | #include "nodes/params.h" |
| 19 | #include "nodes/parsenodes.h" |
| 20 | #include "tcop/dest.h" |
| 21 | #include "utils/array.h" |
| 22 | |
| 23 | /* commands/dropcmds.c */ |
| 24 | extern void RemoveObjects(DropStmt *stmt); |
| 25 | |
| 26 | /* commands/indexcmds.c */ |
| 27 | extern ObjectAddress DefineIndex(Oid relationId, |
| 28 | IndexStmt *stmt, |
| 29 | Oid indexRelationId, |
| 30 | Oid parentIndexId, |
| 31 | Oid parentConstraintId, |
| 32 | bool is_alter_table, |
| 33 | bool check_rights, |
| 34 | bool check_not_in_use, |
| 35 | bool skip_build, |
| 36 | bool quiet); |
| 37 | extern void ReindexIndex(RangeVar *indexRelation, int options, bool concurrent); |
| 38 | extern Oid ReindexTable(RangeVar *relation, int options, bool concurrent); |
| 39 | extern void ReindexMultipleTables(const char *objectName, ReindexObjectType objectKind, |
| 40 | int options, bool concurrent); |
| 41 | extern char *makeObjectName(const char *name1, const char *name2, |
| 42 | const char *label); |
| 43 | extern char *ChooseRelationName(const char *name1, const char *name2, |
| 44 | const char *label, Oid namespaceid, |
| 45 | bool isconstraint); |
| 46 | extern bool CheckIndexCompatible(Oid oldId, |
| 47 | const char *accessMethodName, |
| 48 | List *attributeList, |
| 49 | List *exclusionOpNames); |
| 50 | extern Oid GetDefaultOpClass(Oid type_id, Oid am_id); |
| 51 | extern Oid ResolveOpClass(List *opclass, Oid attrType, |
| 52 | const char *accessMethodName, Oid accessMethodId); |
| 53 | |
| 54 | /* commands/functioncmds.c */ |
| 55 | extern ObjectAddress CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt); |
| 56 | extern void RemoveFunctionById(Oid funcOid); |
| 57 | extern void SetFunctionReturnType(Oid funcOid, Oid newRetType); |
| 58 | extern void SetFunctionArgType(Oid funcOid, int argIndex, Oid newArgType); |
| 59 | extern ObjectAddress AlterFunction(ParseState *pstate, AlterFunctionStmt *stmt); |
| 60 | extern ObjectAddress CreateCast(CreateCastStmt *stmt); |
| 61 | extern void DropCastById(Oid castOid); |
| 62 | extern ObjectAddress CreateTransform(CreateTransformStmt *stmt); |
| 63 | extern void DropTransformById(Oid transformOid); |
| 64 | extern void IsThereFunctionInNamespace(const char *proname, int pronargs, |
| 65 | oidvector *proargtypes, Oid nspOid); |
| 66 | extern void ExecuteDoStmt(DoStmt *stmt, bool atomic); |
| 67 | extern void ExecuteCallStmt(CallStmt *stmt, ParamListInfo params, bool atomic, DestReceiver *dest); |
| 68 | extern TupleDesc CallStmtResultDesc(CallStmt *stmt); |
| 69 | extern Oid get_cast_oid(Oid sourcetypeid, Oid targettypeid, bool missing_ok); |
| 70 | extern Oid get_transform_oid(Oid type_id, Oid lang_id, bool missing_ok); |
| 71 | extern void interpret_function_parameter_list(ParseState *pstate, |
| 72 | List *parameters, |
| 73 | Oid languageOid, |
| 74 | ObjectType objtype, |
| 75 | oidvector **parameterTypes, |
| 76 | ArrayType **allParameterTypes, |
| 77 | ArrayType **parameterModes, |
| 78 | ArrayType **parameterNames, |
| 79 | List **parameterDefaults, |
| 80 | Oid *variadicArgType, |
| 81 | Oid *requiredResultType); |
| 82 | |
| 83 | /* commands/operatorcmds.c */ |
| 84 | extern ObjectAddress DefineOperator(List *names, List *parameters); |
| 85 | extern void RemoveOperatorById(Oid operOid); |
| 86 | extern ObjectAddress AlterOperator(AlterOperatorStmt *stmt); |
| 87 | |
| 88 | /* commands/statscmds.c */ |
| 89 | extern ObjectAddress CreateStatistics(CreateStatsStmt *stmt); |
| 90 | extern void RemoveStatisticsById(Oid statsOid); |
| 91 | extern void UpdateStatisticsForTypeChange(Oid statsOid, |
| 92 | Oid relationOid, int attnum, |
| 93 | Oid oldColumnType, Oid newColumnType); |
| 94 | |
| 95 | /* commands/aggregatecmds.c */ |
| 96 | extern ObjectAddress DefineAggregate(ParseState *pstate, List *name, List *args, bool oldstyle, |
| 97 | List *parameters, bool replace); |
| 98 | |
| 99 | /* commands/opclasscmds.c */ |
| 100 | extern ObjectAddress DefineOpClass(CreateOpClassStmt *stmt); |
| 101 | extern ObjectAddress DefineOpFamily(CreateOpFamilyStmt *stmt); |
| 102 | extern Oid AlterOpFamily(AlterOpFamilyStmt *stmt); |
| 103 | extern void RemoveOpClassById(Oid opclassOid); |
| 104 | extern void RemoveOpFamilyById(Oid opfamilyOid); |
| 105 | extern void RemoveAmOpEntryById(Oid entryOid); |
| 106 | extern void RemoveAmProcEntryById(Oid entryOid); |
| 107 | extern void IsThereOpClassInNamespace(const char *opcname, Oid opcmethod, |
| 108 | Oid opcnamespace); |
| 109 | extern void IsThereOpFamilyInNamespace(const char *opfname, Oid opfmethod, |
| 110 | Oid opfnamespace); |
| 111 | extern Oid get_opclass_oid(Oid amID, List *opclassname, bool missing_ok); |
| 112 | extern Oid get_opfamily_oid(Oid amID, List *opfamilyname, bool missing_ok); |
| 113 | |
| 114 | /* commands/tsearchcmds.c */ |
| 115 | extern ObjectAddress DefineTSParser(List *names, List *parameters); |
| 116 | extern void RemoveTSParserById(Oid prsId); |
| 117 | |
| 118 | extern ObjectAddress DefineTSDictionary(List *names, List *parameters); |
| 119 | extern void RemoveTSDictionaryById(Oid dictId); |
| 120 | extern ObjectAddress AlterTSDictionary(AlterTSDictionaryStmt *stmt); |
| 121 | |
| 122 | extern ObjectAddress DefineTSTemplate(List *names, List *parameters); |
| 123 | extern void RemoveTSTemplateById(Oid tmplId); |
| 124 | |
| 125 | extern ObjectAddress DefineTSConfiguration(List *names, List *parameters, |
| 126 | ObjectAddress *copied); |
| 127 | extern void RemoveTSConfigurationById(Oid cfgId); |
| 128 | extern ObjectAddress AlterTSConfiguration(AlterTSConfigurationStmt *stmt); |
| 129 | |
| 130 | extern text *serialize_deflist(List *deflist); |
| 131 | extern List *deserialize_deflist(Datum txt); |
| 132 | |
| 133 | /* commands/foreigncmds.c */ |
| 134 | extern ObjectAddress AlterForeignServerOwner(const char *name, Oid newOwnerId); |
| 135 | extern void AlterForeignServerOwner_oid(Oid, Oid newOwnerId); |
| 136 | extern ObjectAddress AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId); |
| 137 | extern void AlterForeignDataWrapperOwner_oid(Oid fwdId, Oid newOwnerId); |
| 138 | extern ObjectAddress CreateForeignDataWrapper(CreateFdwStmt *stmt); |
| 139 | extern ObjectAddress AlterForeignDataWrapper(AlterFdwStmt *stmt); |
| 140 | extern void RemoveForeignDataWrapperById(Oid fdwId); |
| 141 | extern ObjectAddress CreateForeignServer(CreateForeignServerStmt *stmt); |
| 142 | extern ObjectAddress AlterForeignServer(AlterForeignServerStmt *stmt); |
| 143 | extern void RemoveForeignServerById(Oid srvId); |
| 144 | extern ObjectAddress CreateUserMapping(CreateUserMappingStmt *stmt); |
| 145 | extern ObjectAddress AlterUserMapping(AlterUserMappingStmt *stmt); |
| 146 | extern Oid RemoveUserMapping(DropUserMappingStmt *stmt); |
| 147 | extern void RemoveUserMappingById(Oid umId); |
| 148 | extern void CreateForeignTable(CreateForeignTableStmt *stmt, Oid relid); |
| 149 | extern void ImportForeignSchema(ImportForeignSchemaStmt *stmt); |
| 150 | extern Datum transformGenericOptions(Oid catalogId, |
| 151 | Datum oldOptions, |
| 152 | List *options, |
| 153 | Oid fdwvalidator); |
| 154 | |
| 155 | /* commands/amcmds.c */ |
| 156 | extern ObjectAddress CreateAccessMethod(CreateAmStmt *stmt); |
| 157 | extern void RemoveAccessMethodById(Oid amOid); |
| 158 | extern Oid get_index_am_oid(const char *amname, bool missing_ok); |
| 159 | extern Oid get_table_am_oid(const char *amname, bool missing_ok); |
| 160 | extern Oid get_am_oid(const char *amname, bool missing_ok); |
| 161 | extern char *get_am_name(Oid amOid); |
| 162 | |
| 163 | /* support routines in commands/define.c */ |
| 164 | |
| 165 | extern char *defGetString(DefElem *def); |
| 166 | extern double defGetNumeric(DefElem *def); |
| 167 | extern bool defGetBoolean(DefElem *def); |
| 168 | extern int32 defGetInt32(DefElem *def); |
| 169 | extern int64 defGetInt64(DefElem *def); |
| 170 | extern List *defGetQualifiedName(DefElem *def); |
| 171 | extern TypeName *defGetTypeName(DefElem *def); |
| 172 | extern int defGetTypeLength(DefElem *def); |
| 173 | extern List *defGetStringList(DefElem *def); |
| 174 | |
| 175 | #endif /* DEFREM_H */ |
| 176 | |