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-2024, 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 "access/stratnum.h"
18 #include "catalog/objectaddress.h"
19 #include "nodes/params.h"
20 #include "parser/parse_node.h"
21 #include "tcop/dest.h"
22 #include "utils/array.h"
23 
24 /* commands/dropcmds.c */
25 extern void RemoveObjects(DropStmt *stmt);
26 
27 /* commands/indexcmds.c */
28 extern ObjectAddress DefineIndex(Oid tableId,
29  IndexStmt *stmt,
30  Oid indexRelationId,
31  Oid parentIndexId,
32  Oid parentConstraintId,
33  int total_parts,
34  bool is_alter_table,
35  bool check_rights,
36  bool check_not_in_use,
37  bool skip_build,
38  bool quiet);
39 extern void ExecReindex(ParseState *pstate, const ReindexStmt *stmt, bool isTopLevel);
40 extern char *makeObjectName(const char *name1, const char *name2,
41  const char *label);
42 extern char *ChooseRelationName(const char *name1, const char *name2,
43  const char *label, Oid namespaceid,
44  bool isconstraint);
45 extern bool CheckIndexCompatible(Oid oldId,
46  const char *accessMethodName,
47  const List *attributeList,
48  const List *exclusionOpNames,
49  bool isWithoutOverlaps);
50 extern Oid GetDefaultOpClass(Oid type_id, Oid am_id);
51 extern Oid ResolveOpClass(const List *opclass, Oid attrType,
52  const char *accessMethodName, Oid accessMethodId);
53 extern void GetOperatorFromWellKnownStrategy(Oid opclass, Oid rhstype,
54  Oid *opid, StrategyNumber *strat);
55 
56 /* commands/functioncmds.c */
58 extern void RemoveFunctionById(Oid funcOid);
62 extern void IsThereFunctionInNamespace(const char *proname, int pronargs,
63  oidvector *proargtypes, Oid nspOid);
64 extern void ExecuteDoStmt(ParseState *pstate, DoStmt *stmt, bool atomic);
65 extern void ExecuteCallStmt(CallStmt *stmt, ParamListInfo params, bool atomic, DestReceiver *dest);
67 extern Oid get_transform_oid(Oid type_id, Oid lang_id, bool missing_ok);
69  List *parameters,
70  Oid languageOid,
71  ObjectType objtype,
72  oidvector **parameterTypes,
73  List **parameterTypes_list,
74  ArrayType **allParameterTypes,
75  ArrayType **parameterModes,
76  ArrayType **parameterNames,
77  List **inParameterNames_list,
78  List **parameterDefaults,
79  Oid *variadicArgType,
80  Oid *requiredResultType);
81 
82 /* commands/operatorcmds.c */
83 extern ObjectAddress DefineOperator(List *names, List *parameters);
84 extern void RemoveOperatorById(Oid operOid);
86 
87 /* commands/statscmds.c */
90 extern void RemoveStatisticsById(Oid statsOid);
91 extern void RemoveStatisticsDataById(Oid statsOid, bool inh);
92 extern Oid StatisticsGetRelation(Oid statId, bool missing_ok);
93 
94 /* commands/aggregatecmds.c */
95 extern ObjectAddress DefineAggregate(ParseState *pstate, List *name, List *args, bool oldstyle,
96  List *parameters, bool replace);
97 
98 /* commands/opclasscmds.c */
102 extern void IsThereOpClassInNamespace(const char *opcname, Oid opcmethod,
103  Oid opcnamespace);
104 extern void IsThereOpFamilyInNamespace(const char *opfname, Oid opfmethod,
105  Oid opfnamespace);
106 extern Oid get_opclass_oid(Oid amID, List *opclassname, bool missing_ok);
107 extern Oid get_opfamily_oid(Oid amID, List *opfamilyname, bool missing_ok);
108 
109 /* commands/tsearchcmds.c */
110 extern ObjectAddress DefineTSParser(List *names, List *parameters);
111 
112 extern ObjectAddress DefineTSDictionary(List *names, List *parameters);
114 
115 extern ObjectAddress DefineTSTemplate(List *names, List *parameters);
116 
117 extern ObjectAddress DefineTSConfiguration(List *names, List *parameters,
118  ObjectAddress *copied);
119 extern void RemoveTSConfigurationById(Oid cfgId);
121 
122 extern text *serialize_deflist(List *deflist);
123 extern List *deserialize_deflist(Datum txt);
124 
125 /* commands/foreigncmds.c */
126 extern ObjectAddress AlterForeignServerOwner(const char *name, Oid newOwnerId);
127 extern void AlterForeignServerOwner_oid(Oid, Oid newOwnerId);
128 extern ObjectAddress AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId);
129 extern void AlterForeignDataWrapperOwner_oid(Oid fwdId, Oid newOwnerId);
139 extern Datum transformGenericOptions(Oid catalogId,
140  Datum oldOptions,
141  List *options,
142  Oid fdwvalidator);
143 
144 /* commands/amcmds.c */
146 extern Oid get_index_am_oid(const char *amname, bool missing_ok);
147 extern Oid get_table_am_oid(const char *amname, bool missing_ok);
148 extern Oid get_am_oid(const char *amname, bool missing_ok);
149 extern char *get_am_name(Oid amOid);
150 
151 /* support routines in commands/define.c */
152 
153 extern char *defGetString(DefElem *def);
154 extern double defGetNumeric(DefElem *def);
155 extern bool defGetBoolean(DefElem *def);
156 extern int32 defGetInt32(DefElem *def);
157 extern int64 defGetInt64(DefElem *def);
158 extern Oid defGetObjectId(DefElem *def);
159 extern List *defGetQualifiedName(DefElem *def);
160 extern TypeName *defGetTypeName(DefElem *def);
161 extern int defGetTypeLength(DefElem *def);
162 extern List *defGetStringList(DefElem *def);
163 extern void errorConflictingDefElem(DefElem *defel, ParseState *pstate) pg_attribute_noreturn();
164 
165 #endif /* DEFREM_H */
signed int int32
Definition: c.h:494
#define pg_attribute_noreturn()
Definition: c.h:217
void AlterForeignServerOwner_oid(Oid, Oid newOwnerId)
Definition: foreigncmds.c:450
char * makeObjectName(const char *name1, const char *name2, const char *label)
Definition: indexcmds.c:2529
void ExecuteCallStmt(CallStmt *stmt, ParamListInfo params, bool atomic, DestReceiver *dest)
void ExecReindex(ParseState *pstate, const ReindexStmt *stmt, bool isTopLevel)
Definition: indexcmds.c:2801
ObjectAddress AlterTSConfiguration(AlterTSConfigurationStmt *stmt)
Definition: tsearchcmds.c:1156
ObjectAddress DefineTSTemplate(List *names, List *parameters)
Definition: tsearchcmds.c:690
ObjectAddress DefineTSDictionary(List *names, List *parameters)
Definition: tsearchcmds.c:397
ObjectAddress AlterForeignServerOwner(const char *name, Oid newOwnerId)
Definition: foreigncmds.c:415
ObjectAddress CreateCast(CreateCastStmt *stmt)
ObjectAddress DefineOpClass(CreateOpClassStmt *stmt)
Definition: opclasscmds.c:332
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:535
ObjectAddress AlterStatistics(AlterStatsStmt *stmt)
Definition: statscmds.c:599
void ImportForeignSchema(ImportForeignSchemaStmt *stmt)
Definition: foreigncmds.c:1484
void RemoveTSConfigurationById(Oid cfgId)
Definition: tsearchcmds.c:1108
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:62
void RemoveObjects(DropStmt *stmt)
Definition: dropcmds.c:53
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:182
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:219
ObjectAddress AlterOperator(AlterOperatorStmt *stmt)
Definition: operatorcmds.c:462
int32 defGetInt32(DefElem *def)
Definition: define.c:162
void IsThereOpFamilyInNamespace(const char *opfname, Oid opfmethod, Oid opfnamespace)
Definition: opclasscmds.c:1730
void RemoveOperatorById(Oid operOid)
Definition: operatorcmds.c:413
Oid GetDefaultOpClass(Oid type_id, Oid am_id)
Definition: indexcmds.c:2338
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:384
int defGetTypeLength(DefElem *def)
Definition: define.c:312
void RemoveStatisticsDataById(Oid statsOid, bool inh)
Definition: statscmds.c:722
bool defGetBoolean(DefElem *def)
Definition: define.c:107
List * deserialize_deflist(Datum txt)
Definition: tsearchcmds.c:1621
List * defGetQualifiedName(DefElem *def)
Definition: define.c:252
ObjectAddress CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt)
void RemoveStatisticsById(Oid statsOid)
Definition: statscmds.c:747
char * get_am_name(Oid amOid)
Definition: amcmds.c:192
ObjectAddress DefineOpFamily(CreateOpFamilyStmt *stmt)
Definition: opclasscmds.c:771
void AlterForeignDataWrapperOwner_oid(Oid fwdId, Oid newOwnerId)
Definition: foreigncmds.c:313
char * defGetString(DefElem *def)
Definition: define.c:48
ObjectAddress DefineTSConfiguration(List *names, List *parameters, ObjectAddress *copied)
Definition: tsearchcmds.c:899
ObjectAddress DefineAggregate(ParseState *pstate, List *name, List *args, bool oldstyle, List *parameters, bool replace)
Definition: aggregatecmds.c:53
void IsThereFunctionInNamespace(const char *proname, int pronargs, oidvector *proargtypes, Oid nspOid)
int64 defGetInt64(DefElem *def)
Definition: define.c:186
bool CheckIndexCompatible(Oid oldId, const char *accessMethodName, const List *attributeList, const List *exclusionOpNames, bool isWithoutOverlaps)
Definition: indexcmds.c:177
ObjectAddress AlterForeignDataWrapper(ParseState *pstate, AlterFdwStmt *stmt)
Definition: foreigncmds.c:674
ObjectAddress AlterFunction(ParseState *pstate, AlterFunctionStmt *stmt)
void GetOperatorFromWellKnownStrategy(Oid opclass, Oid rhstype, Oid *opid, StrategyNumber *strat)
Definition: indexcmds.c:2441
ObjectAddress CreateForeignServer(CreateForeignServerStmt *stmt)
Definition: foreigncmds.c:838
Oid ResolveOpClass(const List *opclass, Oid attrType, const char *accessMethodName, Oid accessMethodId)
Definition: indexcmds.c:2253
ObjectAddress AlterTSDictionary(AlterTSDictionaryStmt *stmt)
Definition: tsearchcmds.c:493
Oid RemoveUserMapping(DropUserMappingStmt *stmt)
Definition: foreigncmds.c:1324
ObjectAddress DefineTSParser(List *names, List *parameters)
Definition: tsearchcmds.c:184
ObjectAddress CreateForeignDataWrapper(ParseState *pstate, CreateFdwStmt *stmt)
Definition: foreigncmds.c:558
TupleDesc CallStmtResultDesc(CallStmt *stmt)
Oid defGetObjectId(DefElem *def)
Definition: define.c:219
Oid AlterOpFamily(AlterOpFamilyStmt *stmt)
Definition: opclasscmds.c:816
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:81
void ExecuteDoStmt(ParseState *pstate, DoStmt *stmt, bool atomic)
Oid StatisticsGetRelation(Oid statId, bool missing_ok)
Definition: statscmds.c:898
text * serialize_deflist(List *deflist)
Definition: tsearchcmds.c:1565
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:138
void CreateForeignTable(CreateForeignTableStmt *stmt, Oid relid)
Definition: foreigncmds.c:1404
ObjectAddress CreateTransform(CreateTransformStmt *stmt)
TypeName * defGetTypeName(DefElem *def)
Definition: define.c:284
List * defGetStringList(DefElem *def)
Definition: define.c:356
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:1707
char * ChooseRelationName(const char *name1, const char *name2, const char *label, Oid namespaceid, bool isconstraint)
Definition: indexcmds.c:2615
ObjectAddress CreateUserMapping(CreateUserMappingStmt *stmt)
Definition: foreigncmds.c:1100
#define stmt
Definition: indent_codes.h:59
ObjectType
Definition: parsenodes.h:2260
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
uint16 StrategyNumber
Definition: stratnum.h:22
Definition: pg_list.h:54
Definition: c.h:726
Definition: c.h:687
const char * name