PostgreSQL Source Code  git master
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-2021, 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
17 #include "catalog/objectaddress.h"
18 #include "nodes/params.h"
19 #include "parser/parse_node.h"
20 #include "tcop/dest.h"
21 #include "utils/array.h"
23 /* commands/dropcmds.c */
24 extern void RemoveObjects(DropStmt *stmt);
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 ExecReindex(ParseState *pstate, ReindexStmt *stmt, bool isTopLevel);
38 extern char *makeObjectName(const char *name1, const char *name2,
39  const char *label);
40 extern char *ChooseRelationName(const char *name1, const char *name2,
41  const char *label, Oid namespaceid,
42  bool isconstraint);
43 extern bool CheckIndexCompatible(Oid oldId,
44  const char *accessMethodName,
45  List *attributeList,
46  List *exclusionOpNames);
47 extern Oid GetDefaultOpClass(Oid type_id, Oid am_id);
48 extern Oid ResolveOpClass(List *opclass, Oid attrType,
49  const char *accessMethodName, Oid accessMethodId);
51 /* commands/functioncmds.c */
53 extern void RemoveFunctionById(Oid funcOid);
57 extern void IsThereFunctionInNamespace(const char *proname, int pronargs,
58  oidvector *proargtypes, Oid nspOid);
59 extern void ExecuteDoStmt(ParseState *pstate, DoStmt *stmt, bool atomic);
60 extern void ExecuteCallStmt(CallStmt *stmt, ParamListInfo params, bool atomic, DestReceiver *dest);
62 extern Oid get_transform_oid(Oid type_id, Oid lang_id, bool missing_ok);
64  List *parameters,
65  Oid languageOid,
66  ObjectType objtype,
67  oidvector **parameterTypes,
68  List **parameterTypes_list,
69  ArrayType **allParameterTypes,
70  ArrayType **parameterModes,
71  ArrayType **parameterNames,
72  List **inParameterNames_list,
73  List **parameterDefaults,
74  Oid *variadicArgType,
75  Oid *requiredResultType);
77 /* commands/operatorcmds.c */
78 extern ObjectAddress DefineOperator(List *names, List *parameters);
79 extern void RemoveOperatorById(Oid operOid);
82 /* commands/statscmds.c */
85 extern void RemoveStatisticsById(Oid statsOid);
86 extern Oid StatisticsGetRelation(Oid statId, bool missing_ok);
88 /* commands/aggregatecmds.c */
89 extern ObjectAddress DefineAggregate(ParseState *pstate, List *name, List *args, bool oldstyle,
90  List *parameters, bool replace);
92 /* commands/opclasscmds.c */
95 extern Oid AlterOpFamily(AlterOpFamilyStmt *stmt);
96 extern void IsThereOpClassInNamespace(const char *opcname, Oid opcmethod,
97  Oid opcnamespace);
98 extern void IsThereOpFamilyInNamespace(const char *opfname, Oid opfmethod,
99  Oid opfnamespace);
100 extern Oid get_opclass_oid(Oid amID, List *opclassname, bool missing_ok);
101 extern Oid get_opfamily_oid(Oid amID, List *opfamilyname, bool missing_ok);
103 /* commands/tsearchcmds.c */
104 extern ObjectAddress DefineTSParser(List *names, List *parameters);
106 extern ObjectAddress DefineTSDictionary(List *names, List *parameters);
109 extern ObjectAddress DefineTSTemplate(List *names, List *parameters);
111 extern ObjectAddress DefineTSConfiguration(List *names, List *parameters,
112  ObjectAddress *copied);
113 extern void RemoveTSConfigurationById(Oid cfgId);
116 extern text *serialize_deflist(List *deflist);
117 extern List *deserialize_deflist(Datum txt);
119 /* commands/foreigncmds.c */
120 extern ObjectAddress AlterForeignServerOwner(const char *name, Oid newOwnerId);
121 extern void AlterForeignServerOwner_oid(Oid, Oid newOwnerId);
122 extern ObjectAddress AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId);
123 extern void AlterForeignDataWrapperOwner_oid(Oid fwdId, Oid newOwnerId);
131 extern void CreateForeignTable(CreateForeignTableStmt *stmt, Oid relid);
133 extern Datum transformGenericOptions(Oid catalogId,
134  Datum oldOptions,
135  List *options,
136  Oid fdwvalidator);
138 /* commands/amcmds.c */
140 extern Oid get_index_am_oid(const char *amname, bool missing_ok);
141 extern Oid get_table_am_oid(const char *amname, bool missing_ok);
142 extern Oid get_am_oid(const char *amname, bool missing_ok);
143 extern char *get_am_name(Oid amOid);
145 /* support routines in commands/define.c */
147 extern char *defGetString(DefElem *def);
148 extern double defGetNumeric(DefElem *def);
149 extern bool defGetBoolean(DefElem *def);
150 extern int32 defGetInt32(DefElem *def);
151 extern int64 defGetInt64(DefElem *def);
152 extern List *defGetQualifiedName(DefElem *def);
153 extern TypeName *defGetTypeName(DefElem *def);
154 extern int defGetTypeLength(DefElem *def);
155 extern List *defGetStringList(DefElem *def);
156 extern void errorConflictingDefElem(DefElem *defel, ParseState *pstate) pg_attribute_noreturn();
158 #endif /* DEFREM_H */
Oid RemoveUserMapping(DropUserMappingStmt *stmt)
Definition: foreigncmds.c:1311
List * defGetStringList(DefElem *def)
Definition: define.c:322
Oid GetDefaultOpClass(Oid type_id, Oid am_id)
Definition: indexcmds.c:2089
Oid AlterOpFamily(AlterOpFamilyStmt *stmt)
Definition: opclasscmds.c:808
Definition: c.h:660
#define pg_attribute_noreturn()
Definition: c.h:179
void RemoveFunctionById(Oid funcOid)
char * makeObjectName(const char *name1, const char *name2, const char *label)
Definition: indexcmds.c:2198
Oid ResolveOpClass(List *opclass, Oid attrType, const char *accessMethodName, Oid accessMethodId)
Definition: indexcmds.c:2004
NameData proname
Definition: pg_proc.h:35
void ImportForeignSchema(ImportForeignSchemaStmt *stmt)
Definition: foreigncmds.c:1471
void AlterForeignDataWrapperOwner_oid(Oid fwdId, Oid newOwnerId)
Definition: foreigncmds.c:313
char * get_am_name(Oid amOid)
Definition: amcmds.c:192
void AlterForeignServerOwner_oid(Oid, Oid newOwnerId)
Definition: foreigncmds.c:450
TupleDesc CallStmtResultDesc(CallStmt *stmt)
void interpret_function_parameter_list(ParseState *pstate, List *parameters, Oid languageOid, ObjectType objtype, oidvector **parameterTypes, List **parameterTypes_list, ArrayType **allParameterTypes, ArrayType **parameterModes, ArrayType **parameterNames, List **inParameterNames_list, List **parameterDefaults, Oid *variadicArgType, Oid *requiredResultType)
Definition: functioncmds.c:189
ObjectAddress CreateCast(CreateCastStmt *stmt)
List * defGetQualifiedName(DefElem *def)
Definition: define.c:218
Oid get_index_am_oid(const char *amname, bool missing_ok)
Definition: amcmds.c:163
ObjectAddress AlterForeignDataWrapper(ParseState *pstate, AlterFdwStmt *stmt)
Definition: foreigncmds.c:674
int16 pronargs
Definition: pg_proc.h:81
unsigned int Oid
Definition: postgres_ext.h:31
bool CheckIndexCompatible(Oid oldId, const char *accessMethodName, List *attributeList, List *exclusionOpNames)
Definition: indexcmds.c:164
Oid get_am_oid(const char *amname, bool missing_ok)
Definition: amcmds.c:183
signed int int32
Definition: c.h:429
ObjectAddress DefineTSParser(List *names, List *parameters)
Definition: tsearchcmds.c:178
double defGetNumeric(DefElem *def)
Definition: define.c:80
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:506
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)
ObjectAddress DefineTSTemplate(List *names, List *parameters)
Definition: tsearchcmds.c:684
bool defGetBoolean(DefElem *def)
Definition: define.c:106
ObjectAddress AlterForeignServerOwner(const char *name, Oid newOwnerId)
Definition: foreigncmds.c:415
ObjectAddress CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt)
ObjectAddress DefineTSConfiguration(List *names, List *parameters, ObjectAddress *copied)
Definition: tsearchcmds.c:893
int64 defGetInt64(DefElem *def)
Definition: define.c:185
ObjectAddress AlterStatistics(AlterStatsStmt *stmt)
Definition: statscmds.c:619
void ExecReindex(ParseState *pstate, ReindexStmt *stmt, bool isTopLevel)
Definition: indexcmds.c:2470
int defGetTypeLength(DefElem *def)
Definition: define.c:278
ObjectAddress DefineTSDictionary(List *names, List *parameters)
Definition: tsearchcmds.c:391
ObjectAddress AlterFunction(ParseState *pstate, AlterFunctionStmt *stmt)
TypeName * defGetTypeName(DefElem *def)
Definition: define.c:250
char * ChooseRelationName(const char *name1, const char *name2, const char *label, Oid namespaceid, bool isconstraint)
Definition: indexcmds.c:2284
Definition: parsenodes.h:1787
ObjectAddress DefineOpFamily(CreateOpFamilyStmt *stmt)
Definition: opclasscmds.c:763
ObjectAddress CreateUserMapping(CreateUserMappingStmt *stmt)
Definition: foreigncmds.c:1091
ObjectAddress CreateStatistics(CreateStatsStmt *stmt)
Definition: statscmds.c:65
Oid get_opfamily_oid(Oid amID, List *opfamilyname, bool missing_ok)
Definition: opclasscmds.c:139
ObjectAddress AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId)
Definition: foreigncmds.c:275
uintptr_t Datum
Definition: postgres.h:411
void errorConflictingDefElem(DefElem *defel, ParseState *pstate) pg_attribute_noreturn()
Definition: define.c:350
static char * label
void RemoveOperatorById(Oid operOid)
Definition: operatorcmds.c:364
void ExecuteCallStmt(CallStmt *stmt, ParamListInfo params, bool atomic, DestReceiver *dest)
text * serialize_deflist(List *deflist)
Definition: tsearchcmds.c:1454
void CreateForeignTable(CreateForeignTableStmt *stmt, Oid relid)
Definition: foreigncmds.c:1391
ObjectAddress AlterTSConfiguration(AlterTSConfigurationStmt *stmt)
Definition: tsearchcmds.c:1109
void RemoveTSConfigurationById(Oid cfgId)
Definition: tsearchcmds.c:1061
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:56
ObjectAddress CreateTransform(CreateTransformStmt *stmt)
ObjectAddress CreateForeignDataWrapper(ParseState *pstate, CreateFdwStmt *stmt)
Definition: foreigncmds.c:558
ObjectAddress AlterUserMapping(AlterUserMappingStmt *stmt)
Definition: foreigncmds.c:1213
void IsThereOpFamilyInNamespace(const char *opfname, Oid opfmethod, Oid opfnamespace)
Definition: opclasscmds.c:1722
void ExecuteDoStmt(ParseState *pstate, DoStmt *stmt, bool atomic)
Datum transformGenericOptions(Oid catalogId, Datum oldOptions, List *options, Oid fdwvalidator)
Definition: foreigncmds.c:110
ObjectAddress CreateForeignServer(CreateForeignServerStmt *stmt)
Definition: foreigncmds.c:838
ObjectAddress AlterTSDictionary(AlterTSDictionaryStmt *stmt)
Definition: tsearchcmds.c:487
ObjectAddress AlterForeignServer(AlterForeignServerStmt *stmt)
Definition: foreigncmds.c:965
const char * name
Definition: encode.c:561
char * defGetString(DefElem *def)
Definition: define.c:49
Oid get_table_am_oid(const char *amname, bool missing_ok)
Definition: amcmds.c:173
ObjectAddress DefineOperator(List *names, List *parameters)
Definition: operatorcmds.c:65
ObjectAddress DefineOpClass(CreateOpClassStmt *stmt)
Definition: opclasscmds.c:328
void RemoveObjects(DropStmt *stmt)
Definition: dropcmds.c:57
Oid StatisticsGetRelation(Oid statId, bool missing_ok)
Definition: statscmds.c:876
ObjectAddress CreateAccessMethod(CreateAmStmt *stmt)
Definition: amcmds.c:43
void RemoveStatisticsById(Oid statsOid)
Definition: statscmds.c:723
int32 defGetInt32(DefElem *def)
Definition: define.c:161
Definition: c.h:621
List * deserialize_deflist(Datum txt)
Definition: tsearchcmds.c:1510
ObjectAddress AlterOperator(AlterOperatorStmt *stmt)
Definition: operatorcmds.c:409
Definition: pg_list.h:50
void IsThereOpClassInNamespace(const char *opcname, Oid opcmethod, Oid opcnamespace)
Definition: opclasscmds.c:1699