PostgreSQL Source Code  git master
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-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 */
56 extern void RemoveFunctionById(Oid funcOid);
57 extern void SetFunctionReturnType(Oid funcOid, Oid newRetType);
58 extern void SetFunctionArgType(Oid funcOid, int argIndex, Oid newArgType);
61 extern void DropCastById(Oid castOid);
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);
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);
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);
87 
88 /* commands/statscmds.c */
91 extern void RemoveStatisticsById(Oid statsOid);
92 extern void UpdateStatisticsForTypeChange(Oid statsOid,
93  Oid relationOid, int attnum,
94  Oid oldColumnType, Oid newColumnType);
95 
96 /* commands/aggregatecmds.c */
97 extern ObjectAddress DefineAggregate(ParseState *pstate, List *name, List *args, bool oldstyle,
98  List *parameters, bool replace);
99 
100 /* commands/opclasscmds.c */
103 extern Oid AlterOpFamily(AlterOpFamilyStmt *stmt);
104 extern void RemoveOpClassById(Oid opclassOid);
105 extern void RemoveOpFamilyById(Oid opfamilyOid);
106 extern void RemoveAmOpEntryById(Oid entryOid);
107 extern void RemoveAmProcEntryById(Oid entryOid);
108 extern void IsThereOpClassInNamespace(const char *opcname, Oid opcmethod,
109  Oid opcnamespace);
110 extern void IsThereOpFamilyInNamespace(const char *opfname, Oid opfmethod,
111  Oid opfnamespace);
112 extern Oid get_opclass_oid(Oid amID, List *opclassname, bool missing_ok);
113 extern Oid get_opfamily_oid(Oid amID, List *opfamilyname, bool missing_ok);
114 
115 /* commands/tsearchcmds.c */
116 extern ObjectAddress DefineTSParser(List *names, List *parameters);
117 extern void RemoveTSParserById(Oid prsId);
118 
119 extern ObjectAddress DefineTSDictionary(List *names, List *parameters);
120 extern void RemoveTSDictionaryById(Oid dictId);
122 
123 extern ObjectAddress DefineTSTemplate(List *names, List *parameters);
124 extern void RemoveTSTemplateById(Oid tmplId);
125 
126 extern ObjectAddress DefineTSConfiguration(List *names, List *parameters,
127  ObjectAddress *copied);
128 extern void RemoveTSConfigurationById(Oid cfgId);
130 
131 extern text *serialize_deflist(List *deflist);
132 extern List *deserialize_deflist(Datum txt);
133 
134 /* commands/foreigncmds.c */
135 extern ObjectAddress AlterForeignServerOwner(const char *name, Oid newOwnerId);
136 extern void AlterForeignServerOwner_oid(Oid, Oid newOwnerId);
137 extern ObjectAddress AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId);
138 extern void AlterForeignDataWrapperOwner_oid(Oid fwdId, Oid newOwnerId);
141 extern void RemoveForeignDataWrapperById(Oid fdwId);
144 extern void RemoveForeignServerById(Oid srvId);
148 extern void RemoveUserMappingById(Oid umId);
149 extern void CreateForeignTable(CreateForeignTableStmt *stmt, Oid relid);
151 extern Datum transformGenericOptions(Oid catalogId,
152  Datum oldOptions,
153  List *options,
154  Oid fdwvalidator);
155 
156 /* commands/amcmds.c */
158 extern void RemoveAccessMethodById(Oid amOid);
159 extern Oid get_index_am_oid(const char *amname, bool missing_ok);
160 extern Oid get_table_am_oid(const char *amname, bool missing_ok);
161 extern Oid get_am_oid(const char *amname, bool missing_ok);
162 extern char *get_am_name(Oid amOid);
163 
164 /* support routines in commands/define.c */
165 
166 extern char *defGetString(DefElem *def);
167 extern double defGetNumeric(DefElem *def);
168 extern bool defGetBoolean(DefElem *def);
169 extern int32 defGetInt32(DefElem *def);
170 extern int64 defGetInt64(DefElem *def);
171 extern List *defGetQualifiedName(DefElem *def);
172 extern TypeName *defGetTypeName(DefElem *def);
173 extern int defGetTypeLength(DefElem *def);
174 extern List *defGetStringList(DefElem *def);
175 
176 #endif /* DEFREM_H */
Oid RemoveUserMapping(DropUserMappingStmt *stmt)
Definition: foreigncmds.c:1360
void RemoveTSTemplateById(Oid tmplId)
Definition: tsearchcmds.c:824
List * defGetStringList(DefElem *def)
Definition: define.c:327
Oid GetDefaultOpClass(Oid type_id, Oid am_id)
Definition: indexcmds.c:1939
Oid AlterOpFamily(AlterOpFamilyStmt *stmt)
Definition: opclasscmds.c:775
Definition: c.h:589
void RemoveFunctionById(Oid funcOid)
char * makeObjectName(const char *name1, const char *name2, const char *label)
Definition: indexcmds.c:2048
Oid ResolveOpClass(List *opclass, Oid attrType, const char *accessMethodName, Oid accessMethodId)
Definition: indexcmds.c:1826
NameData proname
Definition: pg_proc.h:36
void RemoveOpClassById(Oid opclassOid)
Definition: opclasscmds.c:1622
void ImportForeignSchema(ImportForeignSchemaStmt *stmt)
Definition: foreigncmds.c:1543
void AlterForeignDataWrapperOwner_oid(Oid fwdId, Oid newOwnerId)
Definition: foreigncmds.c:313
void ExecuteDoStmt(DoStmt *stmt, bool atomic)
char * get_am_name(Oid amOid)
Definition: amcmds.c:216
void AlterForeignServerOwner_oid(Oid, Oid newOwnerId)
Definition: foreigncmds.c:450
TupleDesc CallStmtResultDesc(CallStmt *stmt)
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:187
int16 pronargs
Definition: pg_proc.h:82
unsigned int Oid
Definition: postgres_ext.h:31
Oid get_cast_oid(Oid sourcetypeid, Oid targettypeid, bool missing_ok)
ReindexObjectType
Definition: parsenodes.h:3319
bool CheckIndexCompatible(Oid oldId, const char *accessMethodName, List *attributeList, List *exclusionOpNames)
Definition: indexcmds.c:141
Oid get_am_oid(const char *amname, bool missing_ok)
Definition: amcmds.c:207
signed int int32
Definition: c.h:347
ObjectAddress DefineTSParser(List *names, List *parameters)
Definition: tsearchcmds.c:176
void RemoveOpFamilyById(Oid opfamilyOid)
Definition: opclasscmds.c:1603
void UpdateStatisticsForTypeChange(Oid statsOid, Oid relationOid, int attnum, Oid oldColumnType, Oid newColumnType)
Definition: statscmds.c:602
void RemoveTSParserById(Oid prsId)
Definition: tsearchcmds.c:295
double defGetNumeric(DefElem *def)
Definition: define.c:85
void RemoveAmProcEntryById(Oid entryOid)
Definition: opclasscmds.c:1670
ObjectAddress DefineIndex(Oid relationId, IndexStmt *stmt, Oid indexRelationId, Oid parentIndexId, Oid parentConstraintId, bool is_alter_table, bool check_rights, bool check_not_in_use, bool skip_build, bool quiet)
Definition: indexcmds.c:430
ObjectAddress CreateForeignDataWrapper(CreateFdwStmt *stmt)
Definition: foreigncmds.c:562
Oid get_opclass_oid(Oid amID, List *opclassname, bool missing_ok)
Definition: opclasscmds.c:222
void IsThereFunctionInNamespace(const char *proname, int pronargs, oidvector *proargtypes, Oid nspOid)
ObjectAddress DefineTSTemplate(List *names, List *parameters)
Definition: tsearchcmds.c:730
bool defGetBoolean(DefElem *def)
Definition: define.c:111
ObjectAddress AlterForeignServerOwner(const char *name, Oid newOwnerId)
Definition: foreigncmds.c:415
ObjectAddress CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt)
Definition: functioncmds.c:920
ObjectAddress DefineTSConfiguration(List *names, List *parameters, ObjectAddress *copied)
Definition: tsearchcmds.c:963
int64 defGetInt64(DefElem *def)
Definition: define.c:190
void ReindexMultipleTables(const char *objectName, ReindexObjectType objectKind, int options, bool concurrent)
Definition: indexcmds.c:2478
ObjectAddress AlterStatistics(AlterStatsStmt *stmt)
Definition: statscmds.c:425
void SetFunctionReturnType(Oid funcOid, Oid newRetType)
void RemoveTSDictionaryById(Oid dictId)
Definition: tsearchcmds.c:508
int defGetTypeLength(DefElem *def)
Definition: define.c:283
ObjectAddress DefineTSDictionary(List *names, List *parameters)
Definition: tsearchcmds.c:412
ObjectAddress AlterFunction(ParseState *pstate, AlterFunctionStmt *stmt)
TypeName * defGetTypeName(DefElem *def)
Definition: define.c:255
void SetFunctionArgType(Oid funcOid, int argIndex, Oid newArgType)
char * ChooseRelationName(const char *name1, const char *name2, const char *label, Oid namespaceid, bool isconstraint)
Definition: indexcmds.c:2134
void DropTransformById(Oid transformOid)
ObjectType
Definition: parsenodes.h:1669
ObjectAddress DefineOpFamily(CreateOpFamilyStmt *stmt)
Definition: opclasscmds.c:730
ObjectAddress CreateUserMapping(CreateUserMappingStmt *stmt)
Definition: foreigncmds.c:1143
ObjectAddress CreateStatistics(CreateStatsStmt *stmt)
Definition: statscmds.c:62
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:275
uintptr_t Datum
Definition: postgres.h:367
static char * label
Definition: pg_basebackup.c:86
void RemoveOperatorById(Oid operOid)
Definition: operatorcmds.c:339
void ExecuteCallStmt(CallStmt *stmt, ParamListInfo params, bool atomic, DestReceiver *dest)
text * serialize_deflist(List *deflist)
Definition: tsearchcmds.c:1527
void CreateForeignTable(CreateForeignTableStmt *stmt, Oid relid)
Definition: foreigncmds.c:1463
Oid ReindexTable(RangeVar *relation, int options, bool concurrent)
Definition: indexcmds.c:2434
void RemoveAmOpEntryById(Oid entryOid)
Definition: opclasscmds.c:1641
int16 attnum
Definition: pg_attribute.h:79
ObjectAddress AlterTSConfiguration(AlterTSConfigurationStmt *stmt)
Definition: tsearchcmds.c:1179
void RemoveTSConfigurationById(Oid cfgId)
Definition: tsearchcmds.c:1131
Oid get_transform_oid(Oid type_id, Oid lang_id, bool missing_ok)
ObjectAddress DefineAggregate(ParseState *pstate, List *name, List *args, bool oldstyle, List *parameters, bool replace)
Definition: aggregatecmds.c:57
ObjectAddress CreateTransform(CreateTransformStmt *stmt)
ObjectAddress AlterUserMapping(AlterUserMappingStmt *stmt)
Definition: foreigncmds.c:1265
void IsThereOpFamilyInNamespace(const char *opfname, Oid opfmethod, Oid opfnamespace)
Definition: opclasscmds.c:1728
void ReindexIndex(RangeVar *indexRelation, int options, bool concurrent)
Definition: indexcmds.c:2317
Datum transformGenericOptions(Oid catalogId, Datum oldOptions, List *options, Oid fdwvalidator)
Definition: foreigncmds.c:110
ObjectAddress CreateForeignServer(CreateForeignServerStmt *stmt)
Definition: foreigncmds.c:866
ObjectAddress AlterTSDictionary(AlterTSDictionaryStmt *stmt)
Definition: tsearchcmds.c:532
ObjectAddress AlterForeignServer(AlterForeignServerStmt *stmt)
Definition: foreigncmds.c:993
const char * name
Definition: encode.c:521
char * defGetString(DefElem *def)
Definition: define.c:49
Oid get_table_am_oid(const char *amname, bool missing_ok)
Definition: amcmds.c:197
ObjectAddress DefineOperator(List *names, List *parameters)
Definition: operatorcmds.c:64
ObjectAddress DefineOpClass(CreateOpClassStmt *stmt)
Definition: opclasscmds.c:330
void RemoveObjects(DropStmt *stmt)
Definition: dropcmds.c:56
void interpret_function_parameter_list(ParseState *pstate, List *parameters, Oid languageOid, ObjectType objtype, oidvector **parameterTypes, ArrayType **allParameterTypes, ArrayType **parameterModes, ArrayType **parameterNames, List **parameterDefaults, Oid *variadicArgType, Oid *requiredResultType)
Definition: functioncmds.c:183
ObjectAddress CreateAccessMethod(CreateAmStmt *stmt)
Definition: amcmds.c:42
void RemoveStatisticsById(Oid statsOid)
Definition: statscmds.c:529
int32 defGetInt32(DefElem *def)
Definition: define.c:166
void RemoveUserMappingById(Oid umId)
Definition: foreigncmds.c:1439
Definition: c.h:550
List * deserialize_deflist(Datum txt)
Definition: tsearchcmds.c:1572
void DropCastById(Oid castOid)
ObjectAddress AlterOperator(AlterOperatorStmt *stmt)
Definition: operatorcmds.c:384
Definition: pg_list.h:50
ObjectAddress AlterForeignDataWrapper(AlterFdwStmt *stmt)
Definition: foreigncmds.c:678
void RemoveForeignDataWrapperById(Oid fdwId)
Definition: foreigncmds.c:842
void RemoveAccessMethodById(Oid amOid)
Definition: amcmds.c:119
void RemoveForeignServerById(Oid srvId)
Definition: foreigncmds.c:1092
void IsThereOpClassInNamespace(const char *opcname, Oid opcmethod, Oid opcnamespace)
Definition: opclasscmds.c:1705