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-2023, 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 tableId,
28  IndexStmt *stmt,
29  Oid indexRelationId,
30  Oid parentIndexId,
31  Oid parentConstraintId,
32  int total_parts,
33  bool is_alter_table,
34  bool check_rights,
35  bool check_not_in_use,
36  bool skip_build,
37  bool quiet);
38 extern void ExecReindex(ParseState *pstate, const ReindexStmt *stmt, bool isTopLevel);
39 extern char *makeObjectName(const char *name1, const char *name2,
40  const char *label);
41 extern char *ChooseRelationName(const char *name1, const char *name2,
42  const char *label, Oid namespaceid,
43  bool isconstraint);
44 extern bool CheckIndexCompatible(Oid oldId,
45  const char *accessMethodName,
46  const List *attributeList,
47  const List *exclusionOpNames);
48 extern Oid GetDefaultOpClass(Oid type_id, Oid am_id);
49 extern Oid ResolveOpClass(const List *opclass, Oid attrType,
50  const char *accessMethodName, Oid accessMethodId);
52 /* commands/functioncmds.c */
54 extern void RemoveFunctionById(Oid funcOid);
58 extern void IsThereFunctionInNamespace(const char *proname, int pronargs,
59  oidvector *proargtypes, Oid nspOid);
60 extern void ExecuteDoStmt(ParseState *pstate, DoStmt *stmt, bool atomic);
61 extern void ExecuteCallStmt(CallStmt *stmt, ParamListInfo params, bool atomic, DestReceiver *dest);
63 extern Oid get_transform_oid(Oid type_id, Oid lang_id, bool missing_ok);
65  List *parameters,
66  Oid languageOid,
67  ObjectType objtype,
68  oidvector **parameterTypes,
69  List **parameterTypes_list,
70  ArrayType **allParameterTypes,
71  ArrayType **parameterModes,
72  ArrayType **parameterNames,
73  List **inParameterNames_list,
74  List **parameterDefaults,
75  Oid *variadicArgType,
76  Oid *requiredResultType);
78 /* commands/operatorcmds.c */
79 extern ObjectAddress DefineOperator(List *names, List *parameters);
80 extern void RemoveOperatorById(Oid operOid);
83 /* commands/statscmds.c */
86 extern void RemoveStatisticsById(Oid statsOid);
87 extern void RemoveStatisticsDataById(Oid statsOid, bool inh);
88 extern Oid StatisticsGetRelation(Oid statId, bool missing_ok);
90 /* commands/aggregatecmds.c */
91 extern ObjectAddress DefineAggregate(ParseState *pstate, List *name, List *args, bool oldstyle,
92  List *parameters, bool replace);
94 /* commands/opclasscmds.c */
98 extern void IsThereOpClassInNamespace(const char *opcname, Oid opcmethod,
99  Oid opcnamespace);
100 extern void IsThereOpFamilyInNamespace(const char *opfname, Oid opfmethod,
101  Oid opfnamespace);
102 extern Oid get_opclass_oid(Oid amID, List *opclassname, bool missing_ok);
103 extern Oid get_opfamily_oid(Oid amID, List *opfamilyname, bool missing_ok);
105 /* commands/tsearchcmds.c */
106 extern ObjectAddress DefineTSParser(List *names, List *parameters);
108 extern ObjectAddress DefineTSDictionary(List *names, List *parameters);
111 extern ObjectAddress DefineTSTemplate(List *names, List *parameters);
113 extern ObjectAddress DefineTSConfiguration(List *names, List *parameters,
114  ObjectAddress *copied);
115 extern void RemoveTSConfigurationById(Oid cfgId);
118 extern text *serialize_deflist(List *deflist);
119 extern List *deserialize_deflist(Datum txt);
121 /* commands/foreigncmds.c */
122 extern ObjectAddress AlterForeignServerOwner(const char *name, Oid newOwnerId);
123 extern void AlterForeignServerOwner_oid(Oid, Oid newOwnerId);
124 extern ObjectAddress AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId);
125 extern void AlterForeignDataWrapperOwner_oid(Oid fwdId, Oid newOwnerId);
135 extern Datum transformGenericOptions(Oid catalogId,
136  Datum oldOptions,
137  List *options,
138  Oid fdwvalidator);
140 /* commands/amcmds.c */
142 extern Oid get_index_am_oid(const char *amname, bool missing_ok);
143 extern Oid get_table_am_oid(const char *amname, bool missing_ok);
144 extern Oid get_am_oid(const char *amname, bool missing_ok);
145 extern char *get_am_name(Oid amOid);
147 /* support routines in commands/define.c */
149 extern char *defGetString(DefElem *def);
150 extern double defGetNumeric(DefElem *def);
151 extern bool defGetBoolean(DefElem *def);
152 extern int32 defGetInt32(DefElem *def);
153 extern int64 defGetInt64(DefElem *def);
154 extern Oid defGetObjectId(DefElem *def);
155 extern List *defGetQualifiedName(DefElem *def);
156 extern TypeName *defGetTypeName(DefElem *def);
157 extern int defGetTypeLength(DefElem *def);
158 extern List *defGetStringList(DefElem *def);
159 extern void errorConflictingDefElem(DefElem *defel, ParseState *pstate) pg_attribute_noreturn();
161 #endif /* DEFREM_H */
signed int int32
Definition: c.h:483
#define pg_attribute_noreturn()
Definition: c.h:206
void AlterForeignServerOwner_oid(Oid, Oid newOwnerId)
Definition: foreigncmds.c:450
char * makeObjectName(const char *name1, const char *name2, const char *label)
Definition: indexcmds.c:2419
void ExecuteCallStmt(CallStmt *stmt, ParamListInfo params, bool atomic, DestReceiver *dest)
void ExecReindex(ParseState *pstate, const ReindexStmt *stmt, bool isTopLevel)
Definition: indexcmds.c:2691
ObjectAddress AlterTSConfiguration(AlterTSConfigurationStmt *stmt)
Definition: tsearchcmds.c:1150
bool CheckIndexCompatible(Oid oldId, const char *accessMethodName, const List *attributeList, const List *exclusionOpNames)
Definition: indexcmds.c:171
ObjectAddress DefineTSTemplate(List *names, List *parameters)
Definition: tsearchcmds.c:684
ObjectAddress DefineTSDictionary(List *names, List *parameters)
Definition: tsearchcmds.c:391
ObjectAddress AlterForeignServerOwner(const char *name, Oid newOwnerId)
Definition: foreigncmds.c:415
ObjectAddress CreateCast(CreateCastStmt *stmt)
ObjectAddress DefineOpClass(CreateOpClassStmt *stmt)
Definition: opclasscmds.c:333
ObjectAddress DefineIndex(Oid tableId, IndexStmt *stmt, Oid indexRelationId, Oid parentIndexId, Oid parentConstraintId, int total_parts, bool is_alter_table, bool check_rights, bool check_not_in_use, bool skip_build, bool quiet)
Definition: indexcmds.c:525
ObjectAddress AlterStatistics(AlterStatsStmt *stmt)
Definition: statscmds.c:602
void ImportForeignSchema(ImportForeignSchemaStmt *stmt)
Definition: foreigncmds.c:1484
void RemoveTSConfigurationById(Oid cfgId)
Definition: tsearchcmds.c:1102
ObjectAddress AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId)
Definition: foreigncmds.c:275
ObjectAddress AlterForeignServer(AlterForeignServerStmt *stmt)
Definition: foreigncmds.c:974
ObjectAddress CreateAccessMethod(CreateAmStmt *stmt)
Definition: amcmds.c:43
ObjectAddress CreateStatistics(CreateStatsStmt *stmt)
Definition: statscmds.c:65
void RemoveObjects(DropStmt *stmt)
Definition: dropcmds.c:58
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:188
Oid get_table_am_oid(const char *amname, bool missing_ok)
Definition: amcmds.c:173
Oid get_opclass_oid(Oid amID, List *opclassname, bool missing_ok)
Definition: opclasscmds.c:220
ObjectAddress AlterOperator(AlterOperatorStmt *stmt)
Definition: operatorcmds.c:411
int32 defGetInt32(DefElem *def)
Definition: define.c:163
void IsThereOpFamilyInNamespace(const char *opfname, Oid opfmethod, Oid opfnamespace)
Definition: opclasscmds.c:1731
void RemoveOperatorById(Oid operOid)
Definition: operatorcmds.c:366
Oid GetDefaultOpClass(Oid type_id, Oid am_id)
Definition: indexcmds.c:2310
Oid get_index_am_oid(const char *amname, bool missing_ok)
Definition: amcmds.c:163
void errorConflictingDefElem(DefElem *defel, ParseState *pstate) pg_attribute_noreturn()
Definition: define.c:385
int defGetTypeLength(DefElem *def)
Definition: define.c:313
void RemoveStatisticsDataById(Oid statsOid, bool inh)
Definition: statscmds.c:709
bool defGetBoolean(DefElem *def)
Definition: define.c:108
List * deserialize_deflist(Datum txt)
Definition: tsearchcmds.c:1584
List * defGetQualifiedName(DefElem *def)
Definition: define.c:253
ObjectAddress CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt)
void RemoveStatisticsById(Oid statsOid)
Definition: statscmds.c:734
char * get_am_name(Oid amOid)
Definition: amcmds.c:192
ObjectAddress DefineOpFamily(CreateOpFamilyStmt *stmt)
Definition: opclasscmds.c:772
void AlterForeignDataWrapperOwner_oid(Oid fwdId, Oid newOwnerId)
Definition: foreigncmds.c:313
char * defGetString(DefElem *def)
Definition: define.c:49
ObjectAddress DefineTSConfiguration(List *names, List *parameters, ObjectAddress *copied)
Definition: tsearchcmds.c:893
ObjectAddress DefineAggregate(ParseState *pstate, List *name, List *args, bool oldstyle, List *parameters, bool replace)
Definition: aggregatecmds.c:57
void IsThereFunctionInNamespace(const char *proname, int pronargs, oidvector *proargtypes, Oid nspOid)
int64 defGetInt64(DefElem *def)
Definition: define.c:187
ObjectAddress AlterForeignDataWrapper(ParseState *pstate, AlterFdwStmt *stmt)
Definition: foreigncmds.c:674
ObjectAddress AlterFunction(ParseState *pstate, AlterFunctionStmt *stmt)
ObjectAddress CreateForeignServer(CreateForeignServerStmt *stmt)
Definition: foreigncmds.c:838
Oid ResolveOpClass(const List *opclass, Oid attrType, const char *accessMethodName, Oid accessMethodId)
Definition: indexcmds.c:2225
ObjectAddress AlterTSDictionary(AlterTSDictionaryStmt *stmt)
Definition: tsearchcmds.c:487
Oid RemoveUserMapping(DropUserMappingStmt *stmt)
Definition: foreigncmds.c:1324
ObjectAddress DefineTSParser(List *names, List *parameters)
Definition: tsearchcmds.c:178
ObjectAddress CreateForeignDataWrapper(ParseState *pstate, CreateFdwStmt *stmt)
Definition: foreigncmds.c:558
TupleDesc CallStmtResultDesc(CallStmt *stmt)
Oid defGetObjectId(DefElem *def)
Definition: define.c:220
Oid AlterOpFamily(AlterOpFamilyStmt *stmt)
Definition: opclasscmds.c:817
ObjectAddress AlterUserMapping(AlterUserMappingStmt *stmt)
Definition: foreigncmds.c:1226
ObjectAddress DefineOperator(List *names, List *parameters)
Definition: operatorcmds.c:67
Oid get_transform_oid(Oid type_id, Oid lang_id, bool missing_ok)
double defGetNumeric(DefElem *def)
Definition: define.c:82
void ExecuteDoStmt(ParseState *pstate, DoStmt *stmt, bool atomic)
Oid StatisticsGetRelation(Oid statId, bool missing_ok)
Definition: statscmds.c:878
text * serialize_deflist(List *deflist)
Definition: tsearchcmds.c:1528
Oid get_am_oid(const char *amname, bool missing_ok)
Definition: amcmds.c:183
Oid get_opfamily_oid(Oid amID, List *opfamilyname, bool missing_ok)
Definition: opclasscmds.c:139
void CreateForeignTable(CreateForeignTableStmt *stmt, Oid relid)
Definition: foreigncmds.c:1404
ObjectAddress CreateTransform(CreateTransformStmt *stmt)
TypeName * defGetTypeName(DefElem *def)
Definition: define.c:285
List * defGetStringList(DefElem *def)
Definition: define.c:357
Datum transformGenericOptions(Oid catalogId, Datum oldOptions, List *options, Oid fdwvalidator)
Definition: foreigncmds.c:110
void RemoveFunctionById(Oid funcOid)
void IsThereOpClassInNamespace(const char *opcname, Oid opcmethod, Oid opcnamespace)
Definition: opclasscmds.c:1708
char * ChooseRelationName(const char *name1, const char *name2, const char *label, Oid namespaceid, bool isconstraint)
Definition: indexcmds.c:2505
ObjectAddress CreateUserMapping(CreateUserMappingStmt *stmt)
Definition: foreigncmds.c:1100
#define stmt
Definition: indent_codes.h:59
Definition: parsenodes.h:2119
static char * label
int16 pronargs
Definition: pg_proc.h:81
NameData proname
Definition: pg_proc.h:35
uintptr_t Datum
Definition: postgres.h:64
unsigned int Oid
Definition: postgres_ext.h:31
Definition: pg_list.h:54
Definition: c.h:715
Definition: c.h:676
const char * name