void
index_register(Oid heap,
Oid ind,
- IndexInfo *indexInfo)
+ const IndexInfo *indexInfo)
{
IndexList *newind;
MemoryContext oldcxt;
InsertPgAttributeTuples(Relation pg_attribute_rel,
TupleDesc tupdesc,
Oid new_rel_oid,
- Datum *attoptions,
+ const Datum *attoptions,
CatalogIndexState indstate)
{
TupleTableSlot **slot;
/* non-export function prototypes */
static bool relationHasPrimaryKey(Relation rel);
static TupleDesc ConstructTupleDescriptor(Relation heapRelation,
- IndexInfo *indexInfo,
- List *indexColNames,
+ const IndexInfo *indexInfo,
+ const List *indexColNames,
Oid accessMethodObjectId,
- Oid *collationObjectId,
- Oid *classObjectId);
+ const Oid *collationObjectId,
+ const Oid *classObjectId);
static void InitializeAttributeOids(Relation indexRelation,
int numatts, Oid indexoid);
-static void AppendAttributeTuples(Relation indexRelation, Datum *attopts);
+static void AppendAttributeTuples(Relation indexRelation, const Datum *attopts);
static void UpdateIndexRelation(Oid indexoid, Oid heapoid,
Oid parentIndexId,
- IndexInfo *indexInfo,
- Oid *collationOids,
- Oid *classOids,
- int16 *coloptions,
+ const IndexInfo *indexInfo,
+ const Oid *collationOids,
+ const Oid *classOids,
+ const int16 *coloptions,
bool primary,
bool isexclusion,
bool immediate,
*/
void
index_check_primary_key(Relation heapRel,
- IndexInfo *indexInfo,
+ const IndexInfo *indexInfo,
bool is_alter_table,
- IndexStmt *stmt)
+ const IndexStmt *stmt)
{
int i;
*/
static TupleDesc
ConstructTupleDescriptor(Relation heapRelation,
- IndexInfo *indexInfo,
- List *indexColNames,
+ const IndexInfo *indexInfo,
+ const List *indexColNames,
Oid accessMethodObjectId,
- Oid *collationObjectId,
- Oid *classObjectId)
+ const Oid *collationObjectId,
+ const Oid *classObjectId)
{
int numatts = indexInfo->ii_NumIndexAttrs;
int numkeyatts = indexInfo->ii_NumIndexKeyAttrs;
* ----------------------------------------------------------------
*/
static void
-AppendAttributeTuples(Relation indexRelation, Datum *attopts)
+AppendAttributeTuples(Relation indexRelation, const Datum *attopts)
{
Relation pg_attribute;
CatalogIndexState indstate;
UpdateIndexRelation(Oid indexoid,
Oid heapoid,
Oid parentIndexId,
- IndexInfo *indexInfo,
- Oid *collationOids,
- Oid *classOids,
- int16 *coloptions,
+ const IndexInfo *indexInfo,
+ const Oid *collationOids,
+ const Oid *classOids,
+ const int16 *coloptions,
bool primary,
bool isexclusion,
bool immediate,
Oid parentConstraintId,
RelFileNumber relFileNumber,
IndexInfo *indexInfo,
- List *indexColNames,
+ const List *indexColNames,
Oid accessMethodObjectId,
Oid tableSpaceId,
- Oid *collationObjectId,
- Oid *classObjectId,
- int16 *coloptions,
+ const Oid *collationObjectId,
+ const Oid *classObjectId,
+ const int16 *coloptions,
Datum reloptions,
bits16 flags,
bits16 constr_flags,
index_constraint_create(Relation heapRelation,
Oid indexRelationId,
Oid parentConstraintId,
- IndexInfo *indexInfo,
+ const IndexInfo *indexInfo,
const char *constraintName,
char constraintType,
bits16 constr_flags,
* Use build_attrmap_by_name(index2, index1) to build the attmap.
*/
bool
-CompareIndexInfo(IndexInfo *info1, IndexInfo *info2,
- Oid *collations1, Oid *collations2,
- Oid *opfamilies1, Oid *opfamilies2,
- AttrMap *attmap)
+CompareIndexInfo(const IndexInfo *info1, const IndexInfo *info2,
+ const Oid *collations1, const Oid *collations2,
+ const Oid *opfamilies1, const Oid *opfamilies2,
+ const AttrMap *attmap)
{
int i;
*/
void
reindex_index(Oid indexId, bool skip_constraint_checks, char persistence,
- ReindexParams *params)
+ const ReindexParams *params)
{
Relation iRel,
heapRelation;
* index rebuild.
*/
bool
-reindex_relation(Oid relid, int flags, ReindexParams *params)
+reindex_relation(Oid relid, int flags, const ReindexParams *params)
{
Relation rel;
Oid toast_relid;
* Restore reindex state in a parallel worker.
*/
void
-RestoreReindexState(void *reindexstate)
+RestoreReindexState(const void *reindexstate)
{
- SerializedReindexState *sistate = (SerializedReindexState *) reindexstate;
+ const SerializedReindexState *sistate = (const SerializedReindexState *) reindexstate;
int c = 0;
MemoryContext oldcontext;
* *nspname_p is set to NULL if there is no explicit schema name.
*/
void
-DeconstructQualifiedName(List *names,
+DeconstructQualifiedName(const List *names,
char **nspname_p,
char **objname_p)
{
* if we have to create or clean out the temp namespace.
*/
Oid
-QualifiedNameGetCreationNamespace(List *names, char **objname_p)
+QualifiedNameGetCreationNamespace(const List *names, char **objname_p)
{
char *schemaname;
Oid namespaceId;
* Utility routine to convert a qualified-name list into RangeVar form.
*/
RangeVar *
-makeRangeVarFromNameList(List *names)
+makeRangeVarFromNameList(const List *names)
{
RangeVar *rel = makeRangeVar(NULL, NULL, -1);
* but we also allow A_Star for the convenience of ColumnRef processing.
*/
char *
-NameListToString(List *names)
+NameListToString(const List *names)
{
StringInfoData string;
ListCell *l;
* so the string could be re-parsed (eg, by textToQualifiedNameList).
*/
char *
-NameListToQuotedString(List *names)
+NameListToQuotedString(const List *names)
{
StringInfoData string;
ListCell *l;
/* non-export function prototypes */
-static bool CompareOpclassOptions(Datum *opts1, Datum *opts2, int natts);
+static bool CompareOpclassOptions(const Datum *opts1, const Datum *opts2, int natts);
static void CheckPredicate(Expr *predicate);
static void ComputeIndexAttrs(IndexInfo *indexInfo,
Oid *typeOidP,
Oid *collationOidP,
Oid *classOidP,
int16 *colOptionP,
- List *attList,
- List *exclusionOpNames,
+ const List *attList,
+ const List *exclusionOpNames,
Oid relId,
const char *accessMethodName, Oid accessMethodId,
bool amcanorder,
int ddl_sec_context,
int *ddl_save_nestlevel);
static char *ChooseIndexName(const char *tabname, Oid namespaceId,
- List *colnames, List *exclusionOpNames,
+ const List *colnames, const List *exclusionOpNames,
bool primary, bool isconstraint);
-static char *ChooseIndexNameAddition(List *colnames);
-static List *ChooseIndexColumnNames(List *indexElems);
-static void ReindexIndex(RangeVar *indexRelation, ReindexParams *params,
+static char *ChooseIndexNameAddition(const List *colnames);
+static List *ChooseIndexColumnNames(const List *indexElems);
+static void ReindexIndex(const RangeVar *indexRelation, const ReindexParams *params,
bool isTopLevel);
static void RangeVarCallbackForReindexIndex(const RangeVar *relation,
Oid relId, Oid oldRelId, void *arg);
-static Oid ReindexTable(RangeVar *relation, ReindexParams *params,
+static Oid ReindexTable(const RangeVar *relation, const ReindexParams *params,
bool isTopLevel);
static void ReindexMultipleTables(const char *objectName,
- ReindexObjectType objectKind, ReindexParams *params);
+ ReindexObjectType objectKind, const ReindexParams *params);
static void reindex_error_callback(void *arg);
-static void ReindexPartitions(Oid relid, ReindexParams *params,
+static void ReindexPartitions(Oid relid, const ReindexParams *params,
bool isTopLevel);
-static void ReindexMultipleInternal(List *relids,
- ReindexParams *params);
+static void ReindexMultipleInternal(const List *relids,
+ const ReindexParams *params);
static bool ReindexRelationConcurrently(Oid relationOid,
- ReindexParams *params);
+ const ReindexParams *params);
static void update_relispartition(Oid relationId, bool newval);
static inline void set_indexsafe_procflags(void);
bool
CheckIndexCompatible(Oid oldId,
const char *accessMethodName,
- List *attributeList,
- List *exclusionOpNames)
+ const List *attributeList,
+ const List *exclusionOpNames)
{
bool isconstraint;
Oid *typeObjectId;
* datums. Both elements of arrays and array themselves can be NULL.
*/
static bool
-CompareOpclassOptions(Datum *opts1, Datum *opts2, int natts)
+CompareOpclassOptions(const Datum *opts1, const Datum *opts2, int natts)
{
int i;
Oid *collationOidP,
Oid *classOidP,
int16 *colOptionP,
- List *attList, /* list of IndexElem's */
- List *exclusionOpNames,
+ const List *attList, /* list of IndexElem's */
+ const List *exclusionOpNames,
Oid relId,
const char *accessMethodName,
Oid accessMethodId,
* partition key definitions.
*/
Oid
-ResolveOpClass(List *opclass, Oid attrType,
+ResolveOpClass(const List *opclass, Oid attrType,
const char *accessMethodName, Oid accessMethodId)
{
char *schemaname;
*/
static char *
ChooseIndexName(const char *tabname, Oid namespaceId,
- List *colnames, List *exclusionOpNames,
+ const List *colnames, const List *exclusionOpNames,
bool primary, bool isconstraint)
{
char *indexname;
* ChooseExtendedStatisticNameAddition.
*/
static char *
-ChooseIndexNameAddition(List *colnames)
+ChooseIndexNameAddition(const List *colnames)
{
char buf[NAMEDATALEN * 2];
int buflen = 0;
* Returns a List of plain strings (char *, not String nodes).
*/
static List *
-ChooseIndexColumnNames(List *indexElems)
+ChooseIndexColumnNames(const List *indexElems)
{
List *result = NIL;
ListCell *lc;
* each subroutine of REINDEX.
*/
void
-ExecReindex(ParseState *pstate, ReindexStmt *stmt, bool isTopLevel)
+ExecReindex(ParseState *pstate, const ReindexStmt *stmt, bool isTopLevel)
{
ReindexParams params = {0};
ListCell *lc;
* Recreate a specific index.
*/
static void
-ReindexIndex(RangeVar *indexRelation, ReindexParams *params, bool isTopLevel)
+ReindexIndex(const RangeVar *indexRelation, const ReindexParams *params, bool isTopLevel)
{
struct ReindexIndexCallbackState state;
Oid indOid;
* Recreate all indexes of a table (and of its toast table, if any)
*/
static Oid
-ReindexTable(RangeVar *relation, ReindexParams *params, bool isTopLevel)
+ReindexTable(const RangeVar *relation, const ReindexParams *params, bool isTopLevel)
{
Oid heapOid;
bool result;
*/
static void
ReindexMultipleTables(const char *objectName, ReindexObjectType objectKind,
- ReindexParams *params)
+ const ReindexParams *params)
{
Oid objectOid;
Relation relationRelation;
* by the caller.
*/
static void
-ReindexPartitions(Oid relid, ReindexParams *params, bool isTopLevel)
+ReindexPartitions(Oid relid, const ReindexParams *params, bool isTopLevel)
{
List *partitions = NIL;
char relkind = get_rel_relkind(relid);
* and starts a new transaction when finished.
*/
static void
-ReindexMultipleInternal(List *relids, ReindexParams *params)
+ReindexMultipleInternal(const List *relids, const ReindexParams *params)
{
ListCell *l;
* anyway, and a non-concurrent reindex is more efficient.
*/
static bool
-ReindexRelationConcurrently(Oid relationOid, ReindexParams *params)
+ReindexRelationConcurrently(Oid relationOid, const ReindexParams *params)
{
typedef struct ReindexIndexInfo
{
extern void InsertOneValue(char *value, int i);
extern void InsertOneNull(int i);
-extern void index_register(Oid heap, Oid ind, IndexInfo *indexInfo);
+extern void index_register(Oid heap, Oid ind, const IndexInfo *indexInfo);
extern void build_indices(void);
extern void boot_get_type_io_data(Oid typid,
extern void InsertPgAttributeTuples(Relation pg_attribute_rel,
TupleDesc tupdesc,
Oid new_rel_oid,
- Datum *attoptions,
+ const Datum *attoptions,
CatalogIndexState indstate);
extern void InsertPgClassTuple(Relation pg_class_desc,
} ValidateIndexState;
extern void index_check_primary_key(Relation heapRel,
- IndexInfo *indexInfo,
+ const IndexInfo *indexInfo,
bool is_alter_table,
- IndexStmt *stmt);
+ const IndexStmt *stmt);
#define INDEX_CREATE_IS_PRIMARY (1 << 0)
#define INDEX_CREATE_ADD_CONSTRAINT (1 << 1)
Oid parentConstraintId,
RelFileNumber relFileNumber,
IndexInfo *indexInfo,
- List *indexColNames,
+ const List *indexColNames,
Oid accessMethodObjectId,
Oid tableSpaceId,
- Oid *collationObjectId,
- Oid *classObjectId,
- int16 *coloptions,
+ const Oid *collationObjectId,
+ const Oid *classObjectId,
+ const int16 *coloptions,
Datum reloptions,
bits16 flags,
bits16 constr_flags,
extern ObjectAddress index_constraint_create(Relation heapRelation,
Oid indexRelationId,
Oid parentConstraintId,
- IndexInfo *indexInfo,
+ const IndexInfo *indexInfo,
const char *constraintName,
char constraintType,
bits16 constr_flags,
extern IndexInfo *BuildDummyIndexInfo(Relation index);
-extern bool CompareIndexInfo(IndexInfo *info1, IndexInfo *info2,
- Oid *collations1, Oid *collations2,
- Oid *opfamilies1, Oid *opfamilies2,
- AttrMap *attmap);
+extern bool CompareIndexInfo(const IndexInfo *info1, const IndexInfo *info2,
+ const Oid *collations1, const Oid *collations2,
+ const Oid *opfamilies1, const Oid *opfamilies2,
+ const AttrMap *attmap);
extern void BuildSpeculativeIndexInfo(Relation index, IndexInfo *ii);
extern Oid IndexGetRelation(Oid indexId, bool missing_ok);
extern void reindex_index(Oid indexId, bool skip_constraint_checks,
- char persistence, ReindexParams *params);
+ char persistence, const ReindexParams *params);
/* Flag bits for reindex_relation(): */
#define REINDEX_REL_PROCESS_TOAST 0x01
#define REINDEX_REL_FORCE_INDEXES_UNLOGGED 0x08
#define REINDEX_REL_FORCE_INDEXES_PERMANENT 0x10
-extern bool reindex_relation(Oid relid, int flags, ReindexParams *params);
+extern bool reindex_relation(Oid relid, int flags, const ReindexParams *params);
extern bool ReindexIsProcessingHeap(Oid heapOid);
extern bool ReindexIsProcessingIndex(Oid indexOid);
extern void ResetReindexState(int nestLevel);
extern Size EstimateReindexStateSpace(void);
extern void SerializeReindexState(Size maxsize, char *start_address);
-extern void RestoreReindexState(void *reindexstate);
+extern void RestoreReindexState(const void *reindexstate);
extern void IndexSetParentIndex(Relation partitionIdx, Oid parentOid);
extern Oid get_ts_config_oid(List *names, bool missing_ok);
extern bool TSConfigIsVisible(Oid cfgid);
-extern void DeconstructQualifiedName(List *names,
+extern void DeconstructQualifiedName(const List *names,
char **nspname_p,
char **objname_p);
extern Oid LookupNamespaceNoError(const char *nspname);
extern Oid LookupCreationNamespace(const char *nspname);
extern void CheckSetNamespace(Oid oldNspOid, Oid nspOid);
-extern Oid QualifiedNameGetCreationNamespace(List *names, char **objname_p);
-extern RangeVar *makeRangeVarFromNameList(List *names);
-extern char *NameListToString(List *names);
-extern char *NameListToQuotedString(List *names);
+extern Oid QualifiedNameGetCreationNamespace(const List *names, char **objname_p);
+extern RangeVar *makeRangeVarFromNameList(const List *names);
+extern char *NameListToString(const List *names);
+extern char *NameListToQuotedString(const List *names);
extern bool isTempNamespace(Oid namespaceId);
extern bool isTempToastNamespace(Oid namespaceId);
bool check_not_in_use,
bool skip_build,
bool quiet);
-extern void ExecReindex(ParseState *pstate, ReindexStmt *stmt, bool isTopLevel);
+extern void ExecReindex(ParseState *pstate, const ReindexStmt *stmt, bool isTopLevel);
extern char *makeObjectName(const char *name1, const char *name2,
const char *label);
extern char *ChooseRelationName(const char *name1, const char *name2,
bool isconstraint);
extern bool CheckIndexCompatible(Oid oldId,
const char *accessMethodName,
- List *attributeList,
- List *exclusionOpNames);
+ const List *attributeList,
+ const List *exclusionOpNames);
extern Oid GetDefaultOpClass(Oid type_id, Oid am_id);
-extern Oid ResolveOpClass(List *opclass, Oid attrType,
+extern Oid ResolveOpClass(const List *opclass, Oid attrType,
const char *accessMethodName, Oid accessMethodId);
/* commands/functioncmds.c */