PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
defrem.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * defrem.h
4  * POSTGRES define and remove utility definitions.
5  *
6  *
7  * Portions Copyright (c) 1996-2017, 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/parsenodes.h"
19 #include "utils/array.h"
20 
21 /* commands/dropcmds.c */
22 extern void RemoveObjects(DropStmt *stmt);
23 
24 /* commands/indexcmds.c */
25 extern ObjectAddress DefineIndex(Oid relationId,
26  IndexStmt *stmt,
27  Oid indexRelationId,
28  bool is_alter_table,
29  bool check_rights,
30  bool check_not_in_use,
31  bool skip_build,
32  bool quiet);
33 extern Oid ReindexIndex(RangeVar *indexRelation, int options);
34 extern Oid ReindexTable(RangeVar *relation, int options);
35 extern void ReindexMultipleTables(const char *objectName, ReindexObjectType objectKind,
36  int options);
37 extern char *makeObjectName(const char *name1, const char *name2,
38  const char *label);
39 extern char *ChooseRelationName(const char *name1, const char *name2,
40  const char *label, Oid namespaceid);
41 extern bool CheckIndexCompatible(Oid oldId,
42  char *accessMethodName,
43  List *attributeList,
44  List *exclusionOpNames);
45 extern Oid GetDefaultOpClass(Oid type_id, Oid am_id);
46 extern Oid ResolveOpClass(List *opclass, Oid attrType,
47  char *accessMethodName, Oid accessMethodId);
48 
49 /* commands/functioncmds.c */
51 extern void RemoveFunctionById(Oid funcOid);
52 extern void SetFunctionReturnType(Oid funcOid, Oid newRetType);
53 extern void SetFunctionArgType(Oid funcOid, int argIndex, Oid newArgType);
56 extern void DropCastById(Oid castOid);
58 extern void DropTransformById(Oid transformOid);
59 extern void IsThereFunctionInNamespace(const char *proname, int pronargs,
60  oidvector *proargtypes, Oid nspOid);
61 extern void ExecuteDoStmt(DoStmt *stmt);
62 extern Oid get_cast_oid(Oid sourcetypeid, Oid targettypeid, bool missing_ok);
63 extern Oid get_transform_oid(Oid type_id, Oid lang_id, bool missing_ok);
65  List *parameters,
66  Oid languageOid,
67  bool is_aggregate,
68  oidvector **parameterTypes,
69  ArrayType **allParameterTypes,
70  ArrayType **parameterModes,
71  ArrayType **parameterNames,
72  List **parameterDefaults,
73  Oid *variadicArgType,
74  Oid *requiredResultType);
75 
76 /* commands/operatorcmds.c */
77 extern ObjectAddress DefineOperator(List *names, List *parameters);
78 extern void RemoveOperatorById(Oid operOid);
80 
81 /* commands/statscmds.c */
83 extern void RemoveStatisticsById(Oid statsOid);
84 extern void UpdateStatisticsForTypeChange(Oid statsOid,
85  Oid relationOid, int attnum,
86  Oid oldColumnType, Oid newColumnType);
87 
88 /* commands/aggregatecmds.c */
89 extern ObjectAddress DefineAggregate(ParseState *pstate, List *name, List *args, bool oldstyle,
90  List *parameters);
91 
92 /* commands/opclasscmds.c */
95 extern Oid AlterOpFamily(AlterOpFamilyStmt *stmt);
96 extern void RemoveOpClassById(Oid opclassOid);
97 extern void RemoveOpFamilyById(Oid opfamilyOid);
98 extern void RemoveAmOpEntryById(Oid entryOid);
99 extern void RemoveAmProcEntryById(Oid entryOid);
100 extern void IsThereOpClassInNamespace(const char *opcname, Oid opcmethod,
101  Oid opcnamespace);
102 extern void IsThereOpFamilyInNamespace(const char *opfname, Oid opfmethod,
103  Oid opfnamespace);
104 extern Oid get_opclass_oid(Oid amID, List *opclassname, bool missing_ok);
105 extern Oid get_opfamily_oid(Oid amID, List *opfamilyname, bool missing_ok);
106 
107 /* commands/tsearchcmds.c */
108 extern ObjectAddress DefineTSParser(List *names, List *parameters);
109 extern void RemoveTSParserById(Oid prsId);
110 
111 extern ObjectAddress DefineTSDictionary(List *names, List *parameters);
112 extern void RemoveTSDictionaryById(Oid dictId);
114 
115 extern ObjectAddress DefineTSTemplate(List *names, List *parameters);
116 extern void RemoveTSTemplateById(Oid tmplId);
117 
118 extern ObjectAddress DefineTSConfiguration(List *names, List *parameters,
119  ObjectAddress *copied);
120 extern void RemoveTSConfigurationById(Oid cfgId);
122 
123 extern text *serialize_deflist(List *deflist);
124 extern List *deserialize_deflist(Datum txt);
125 
126 /* commands/foreigncmds.c */
127 extern ObjectAddress AlterForeignServerOwner(const char *name, Oid newOwnerId);
128 extern void AlterForeignServerOwner_oid(Oid, Oid newOwnerId);
129 extern ObjectAddress AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId);
130 extern void AlterForeignDataWrapperOwner_oid(Oid fwdId, Oid newOwnerId);
133 extern void RemoveForeignDataWrapperById(Oid fdwId);
136 extern void RemoveForeignServerById(Oid srvId);
140 extern void RemoveUserMappingById(Oid umId);
141 extern void CreateForeignTable(CreateForeignTableStmt *stmt, Oid relid);
143 extern Datum transformGenericOptions(Oid catalogId,
144  Datum oldOptions,
145  List *options,
146  Oid fdwvalidator);
147 
148 /* commands/amcmds.c */
150 extern void RemoveAccessMethodById(Oid amOid);
151 extern Oid get_index_am_oid(const char *amname, bool missing_ok);
152 extern Oid get_am_oid(const char *amname, bool missing_ok);
153 extern char *get_am_name(Oid amOid);
154 
155 /* support routines in commands/define.c */
156 
157 extern char *defGetString(DefElem *def);
158 extern double defGetNumeric(DefElem *def);
159 extern bool defGetBoolean(DefElem *def);
160 extern int32 defGetInt32(DefElem *def);
161 extern int64 defGetInt64(DefElem *def);
162 extern List *defGetQualifiedName(DefElem *def);
163 extern TypeName *defGetTypeName(DefElem *def);
164 extern int defGetTypeLength(DefElem *def);
165 extern List *defGetStringList(DefElem *def);
166 
167 #endif /* DEFREM_H */
Oid RemoveUserMapping(DropUserMappingStmt *stmt)
Definition: foreigncmds.c:1345
void RemoveTSTemplateById(Oid tmplId)
Definition: tsearchcmds.c:821
List * defGetStringList(DefElem *def)
Definition: define.c:327
Oid GetDefaultOpClass(Oid type_id, Oid am_id)
Definition: indexcmds.c:1391
Oid AlterOpFamily(AlterOpFamilyStmt *stmt)
Definition: opclasscmds.c:763
Definition: c.h:478
void ExecuteDoStmt(DoStmt *stmt)
void RemoveFunctionById(Oid funcOid)
char * makeObjectName(const char *name1, const char *name2, const char *label)
Definition: indexcmds.c:1499
void RemoveOpClassById(Oid opclassOid)
Definition: opclasscmds.c:1566
ObjectAddress DefineIndex(Oid relationId, IndexStmt *stmt, Oid indexRelationId, bool is_alter_table, bool check_rights, bool check_not_in_use, bool skip_build, bool quiet)
Definition: indexcmds.c:308
void ImportForeignSchema(ImportForeignSchemaStmt *stmt)
Definition: foreigncmds.c:1526
void AlterForeignDataWrapperOwner_oid(Oid fwdId, Oid newOwnerId)
Definition: foreigncmds.c:312
char * get_am_name(Oid amOid)
Definition: amcmds.c:202
void AlterForeignServerOwner_oid(Oid, Oid newOwnerId)
Definition: foreigncmds.c:447
Oid ReindexTable(RangeVar *relation, int options)
Definition: indexcmds.c:1844
ObjectAddress CreateCast(CreateCastStmt *stmt)
List * defGetQualifiedName(DefElem *def)
Definition: define.c:223
Oid get_index_am_oid(const char *amname, bool missing_ok)
Definition: amcmds.c:183
void ReindexMultipleTables(const char *objectName, ReindexObjectType objectKind, int options)
Definition: indexcmds.c:1872
unsigned int Oid
Definition: postgres_ext.h:31
Oid get_cast_oid(Oid sourcetypeid, Oid targettypeid, bool missing_ok)
ReindexObjectType
Definition: parsenodes.h:3202
Oid get_am_oid(const char *amname, bool missing_ok)
Definition: amcmds.c:193
signed int int32
Definition: c.h:256
ObjectAddress DefineTSParser(List *names, List *parameters)
Definition: tsearchcmds.c:176
void RemoveOpFamilyById(Oid opfamilyOid)
Definition: opclasscmds.c:1547
void UpdateStatisticsForTypeChange(Oid statsOid, Oid relationOid, int attnum, Oid oldColumnType, Oid newColumnType)
Definition: statscmds.c:392
void RemoveTSParserById(Oid prsId)
Definition: tsearchcmds.c:292
double defGetNumeric(DefElem *def)
Definition: define.c:85
void RemoveAmProcEntryById(Oid entryOid)
Definition: opclasscmds.c:1614
bool CheckIndexCompatible(Oid oldId, char *accessMethodName, List *attributeList, List *exclusionOpNames)
Definition: indexcmds.c:117
ObjectAddress CreateForeignDataWrapper(CreateFdwStmt *stmt)
Definition: foreigncmds.c:560
Oid get_opclass_oid(Oid amID, List *opclassname, bool missing_ok)
Definition: opclasscmds.c:220
void IsThereFunctionInNamespace(const char *proname, int pronargs, oidvector *proargtypes, Oid nspOid)
Oid ReindexIndex(RangeVar *indexRelation, int options)
Definition: indexcmds.c:1750
ObjectAddress DefineTSTemplate(List *names, List *parameters)
Definition: tsearchcmds.c:729
bool defGetBoolean(DefElem *def)
Definition: define.c:111
ObjectAddress AlterForeignServerOwner(const char *name, Oid newOwnerId)
Definition: foreigncmds.c:414
ObjectAddress CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt)
Definition: functioncmds.c:861
ObjectAddress DefineTSConfiguration(List *names, List *parameters, ObjectAddress *copied)
Definition: tsearchcmds.c:960
int64 defGetInt64(DefElem *def)
Definition: define.c:190
void SetFunctionReturnType(Oid funcOid, Oid newRetType)
void RemoveTSDictionaryById(Oid dictId)
Definition: tsearchcmds.c:501
int defGetTypeLength(DefElem *def)
Definition: define.c:283
ObjectAddress DefineTSDictionary(List *names, List *parameters)
Definition: tsearchcmds.c:409
ObjectAddress AlterFunction(ParseState *pstate, AlterFunctionStmt *stmt)
TypeName * defGetTypeName(DefElem *def)
Definition: define.c:255
void SetFunctionArgType(Oid funcOid, int argIndex, Oid newArgType)
void DropTransformById(Oid transformOid)
ObjectAddress DefineOpFamily(CreateOpFamilyStmt *stmt)
Definition: opclasscmds.c:718
ObjectAddress CreateUserMapping(CreateUserMappingStmt *stmt)
Definition: foreigncmds.c:1135
ObjectAddress CreateStatistics(CreateStatsStmt *stmt)
Definition: statscmds.c:49
Oid get_opfamily_oid(Oid amID, List *opfamilyname, bool missing_ok)
Definition: opclasscmds.c:141
ObjectAddress AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId)
Definition: foreigncmds.c:277
uintptr_t Datum
Definition: postgres.h:372
void interpret_function_parameter_list(ParseState *pstate, List *parameters, Oid languageOid, bool is_aggregate, oidvector **parameterTypes, ArrayType **allParameterTypes, ArrayType **parameterModes, ArrayType **parameterNames, List **parameterDefaults, Oid *variadicArgType, Oid *requiredResultType)
Definition: functioncmds.c:179
static char * label
Definition: pg_basebackup.c:81
void RemoveOperatorById(Oid operOid)
Definition: operatorcmds.c:340
text * serialize_deflist(List *deflist)
Definition: tsearchcmds.c:1517
void CreateForeignTable(CreateForeignTableStmt *stmt, Oid relid)
Definition: foreigncmds.c:1446
void RemoveAmOpEntryById(Oid entryOid)
Definition: opclasscmds.c:1585
ObjectAddress AlterTSConfiguration(AlterTSConfigurationStmt *stmt)
Definition: tsearchcmds.c:1173
void RemoveTSConfigurationById(Oid cfgId)
Definition: tsearchcmds.c:1125
Oid get_transform_oid(Oid type_id, Oid lang_id, bool missing_ok)
ObjectAddress CreateTransform(CreateTransformStmt *stmt)
ObjectAddress AlterUserMapping(AlterUserMappingStmt *stmt)
Definition: foreigncmds.c:1250
void IsThereOpFamilyInNamespace(const char *opfname, Oid opfmethod, Oid opfnamespace)
Definition: opclasscmds.c:1672
ObjectAddress DefineAggregate(ParseState *pstate, List *name, List *args, bool oldstyle, List *parameters)
Definition: aggregatecmds.c:54
Oid ResolveOpClass(List *opclass, Oid attrType, char *accessMethodName, Oid accessMethodId)
Definition: indexcmds.c:1280
Datum transformGenericOptions(Oid catalogId, Datum oldOptions, List *options, Oid fdwvalidator)
Definition: foreigncmds.c:109
ObjectAddress CreateForeignServer(CreateForeignServerStmt *stmt)
Definition: foreigncmds.c:861
ObjectAddress AlterTSDictionary(AlterTSDictionaryStmt *stmt)
Definition: tsearchcmds.c:525
ObjectAddress AlterForeignServer(AlterForeignServerStmt *stmt)
Definition: foreigncmds.c:985
const char * name
Definition: encode.c:521
char * defGetString(DefElem *def)
Definition: define.c:49
ObjectAddress DefineOperator(List *names, List *parameters)
Definition: operatorcmds.c:68
ObjectAddress DefineOpClass(CreateOpClassStmt *stmt)
Definition: opclasscmds.c:323
void RemoveObjects(DropStmt *stmt)
Definition: dropcmds.c:54
char * ChooseRelationName(const char *name1, const char *name2, const char *label, Oid namespaceid)
Definition: indexcmds.c:1579
ObjectAddress CreateAccessMethod(CreateAmStmt *stmt)
Definition: amcmds.c:41
void RemoveStatisticsById(Oid statsOid)
Definition: statscmds.c:351
int32 defGetInt32(DefElem *def)
Definition: define.c:166
void RemoveUserMappingById(Oid umId)
Definition: foreigncmds.c:1422
Definition: c.h:439
List * deserialize_deflist(Datum txt)
Definition: tsearchcmds.c:1562
void DropCastById(Oid castOid)
ObjectAddress AlterOperator(AlterOperatorStmt *stmt)
Definition: operatorcmds.c:385
Definition: pg_list.h:45
ObjectAddress AlterForeignDataWrapper(AlterFdwStmt *stmt)
Definition: foreigncmds.c:673
void RemoveForeignDataWrapperById(Oid fdwId)
Definition: foreigncmds.c:837
void RemoveAccessMethodById(Oid amOid)
Definition: amcmds.c:115
void RemoveForeignServerById(Oid srvId)
Definition: foreigncmds.c:1084
void IsThereOpClassInNamespace(const char *opcname, Oid opcmethod, Oid opcnamespace)
Definition: opclasscmds.c:1649