62#include "utils/fmgroids.h"
82 Datum *opclassOptions,
85 const List *exclusionOpNames,
87 const char *accessMethodName,
91 bool iswithoutoverlaps,
94 int *ddl_save_nestlevel);
96 const List *colnames,
const List *exclusionOpNames,
97 bool primary,
bool isconstraint);
178 const char *accessMethodName,
179 const List *attributeList,
180 const List *exclusionOpNames,
181 bool isWithoutOverlaps)
187 Datum *opclassOptions;
198 int numberOfAttributes;
214 isconstraint =
false;
217 Assert(numberOfAttributes > 0);
224 (
errcode(ERRCODE_UNDEFINED_OBJECT),
225 errmsg(
"access method \"%s\" does not exist",
228 accessMethodId = accessMethodForm->oid;
243 indexInfo =
makeIndexInfo(numberOfAttributes, numberOfAttributes,
244 accessMethodId,
NIL,
NIL,
false,
false,
245 false,
false, amsummarizing, isWithoutOverlaps);
252 typeIds, collationIds, opclassIds, opclassOptions,
253 coloptions, attributeList,
254 exclusionOpNames, relationId,
255 accessMethodName, accessMethodId,
256 amcanorder, isconstraint, isWithoutOverlaps,
InvalidOid,
262 elog(
ERROR,
"cache lookup failed for index %u", oldId);
271 indexForm->indisvalid))
278 old_natts = indexForm->indnkeyatts;
279 Assert(old_natts == numberOfAttributes);
287 ret = (memcmp(old_indclass->
values, opclassIds, old_natts *
sizeof(
Oid)) == 0 &&
288 memcmp(old_indcollation->
values, collationIds, old_natts *
sizeof(
Oid)) == 0);
297 for (
i = 0;
i < old_natts;
i++)
312 for (
i = 0;
i < old_natts;
i++)
317 pfree(oldOpclassOptions);
329 old_natts *
sizeof(
Oid)) == 0;
334 for (
i = 0;
i < old_natts && ret;
i++)
340 if ((IsPolymorphicType(left) || IsPolymorphicType(right)) &&
366 if (!opts1 && !opts2)
370 for (
i = 0;
i < natts;
i++)
375 if (opt1 == (
Datum) 0)
377 if (opt2 == (
Datum) 0)
382 else if (opt2 == (
Datum) 0)
447 for (
i = 0;
i < n_old_snapshots;
i++)
456 int n_newer_snapshots;
465 for (
j =
i;
j < n_old_snapshots;
j++)
469 for (k = 0; k < n_newer_snapshots; k++)
475 if (k >= n_newer_snapshots)
478 pfree(newer_snapshots);
545 Oid parentConstraintId,
549 bool check_not_in_use,
554 char *indexRelationName;
555 char *accessMethodName;
559 Datum *opclassOptions;
565 List *allIndexParams;
571 bool amissummarizing;
581 int numberOfAttributes;
582 int numberOfKeyAttributes;
589 Oid root_save_userid;
590 int root_save_sec_context;
591 int root_save_nestlevel;
602 if (
stmt->reset_default_tblspc)
652 stmt->indexIncludingParams);
655 if (numberOfKeyAttributes <= 0)
657 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
658 errmsg(
"must specify at least one column")));
661 (
errcode(ERRCODE_TOO_MANY_COLUMNS),
662 errmsg(
"cannot use more than %d columns in an index",
698 exclusion =
stmt->excludeOpNames ||
stmt->iswithoutoverlaps;
701 switch (rel->
rd_rel->relkind)
703 case RELKIND_RELATION:
704 case RELKIND_MATVIEW:
705 case RELKIND_PARTITIONED_TABLE:
710 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
711 errmsg(
"cannot create index on relation \"%s\"",
725 partitioned = rel->
rd_rel->relkind == RELKIND_PARTITIONED_TABLE;
734 if (
stmt->concurrent)
736 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
737 errmsg(
"cannot create index on partitioned table \"%s\" concurrently",
746 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
747 errmsg(
"cannot create indexes on temporary tables of other sessions")));
755 if (check_not_in_use)
768 aclresult =
object_aclcheck(NamespaceRelationId, namespaceId, root_save_userid,
779 if (
stmt->tableSpace)
784 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
785 errmsg(
"cannot specify default tablespace for partitioned relations")));
800 aclresult =
object_aclcheck(TableSpaceRelationId, tablespaceId, root_save_userid,
812 if (rel->
rd_rel->relisshared)
813 tablespaceId = GLOBALTABLESPACE_OID;
814 else if (tablespaceId == GLOBALTABLESPACE_OID)
816 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
817 errmsg(
"only shared relations can be placed in pg_global tablespace")));
827 indexRelationName =
stmt->idxname;
828 if (indexRelationName == NULL)
832 stmt->excludeOpNames,
839 accessMethodName =
stmt->accessMethod;
847 if (strcmp(accessMethodName,
"rtree") == 0)
850 (
errmsg(
"substituting access method \"gist\" for obsolete method \"rtree\"")));
851 accessMethodName =
"gist";
857 (
errcode(ERRCODE_UNDEFINED_OBJECT),
858 errmsg(
"access method \"%s\" does not exist",
862 accessMethodId = accessMethodForm->oid;
870 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
871 errmsg(
"access method \"%s\" does not support unique indexes",
875 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
876 errmsg(
"access method \"%s\" does not support included columns",
880 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
881 errmsg(
"access method \"%s\" does not support multicolumn indexes",
883 if (exclusion && amRoutine->
amgettuple == NULL)
885 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
886 errmsg(
"access method \"%s\" does not support exclusion constraints",
888 if (
stmt->iswithoutoverlaps && strcmp(accessMethodName,
"gist") != 0)
890 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
891 errmsg(
"access method \"%s\" does not support WITHOUT OVERLAPS constraints",
904 if (
stmt->whereClause)
911 NULL, NULL,
false,
false);
921 numberOfKeyAttributes,
926 stmt->nulls_not_distinct,
930 stmt->iswithoutoverlaps);
938 typeIds, collationIds, opclassIds, opclassOptions,
939 coloptions, allIndexParams,
940 stmt->excludeOpNames, tableId,
941 accessMethodName, accessMethodId,
942 amcanorder,
stmt->isconstraint,
stmt->iswithoutoverlaps,
943 root_save_userid, root_save_sec_context,
944 &root_save_nestlevel);
962 if (partitioned && (
stmt->unique || exclusion))
965 const char *constraint_type;
969 constraint_type =
"PRIMARY KEY";
970 else if (
stmt->unique)
971 constraint_type =
"UNIQUE";
972 else if (
stmt->excludeOpNames)
973 constraint_type =
"EXCLUDE";
977 constraint_type = NULL;
984 for (
i = 0;
i <
key->partnatts;
i++)
1003 key->partopcintype[
i],
1004 key->partopcintype[
i],
1007 elog(
ERROR,
"missing operator %d(%u,%u) in partition opfamily %u",
1008 eq_strategy,
key->partopcintype[
i],
key->partopcintype[
i],
1009 key->partopfamily[
i]);
1015 if (
key->partattrs[
i] == 0)
1017 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1018 errmsg(
"unsupported %s constraint with partition key definition",
1020 errdetail(
"%s constraints cannot be used when partition keys include expressions.",
1035 if (
key->partcollation[
i] != collationIds[
j])
1044 if (
stmt->unique && !
stmt->iswithoutoverlaps)
1054 errcode(ERRCODE_UNDEFINED_OBJECT),
1056 errdetail(
"There is no suitable operator in operator family \"%s\" for access method \"%s\".",
1059 if (ptkey_eqop == idx_eqop)
1075 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1076 errmsg(
"cannot match partition key to index on column \"%s\" using non-equal operator \"%s\"",
1089 key->partattrs[
i] - 1);
1091 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1092 errmsg(
"unique constraint on partitioned table must include all partitioning columns"),
1093 errdetail(
"%s constraint on table \"%s\" lacks column \"%s\" which is part of the partition key.",
1114 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1115 errmsg(
"index creation on system columns is not supported")));
1120 errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1122 errmsg(
"primary keys on virtual generated columns are not supported") :
1123 stmt->isconstraint ?
1124 errmsg(
"unique constraints on virtual generated columns are not supported") :
1125 errmsg(
"indexes on virtual generated columns are not supported"));
1145 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1146 errmsg(
"index creation on system columns is not supported")));
1161 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1162 stmt->isconstraint ?
1163 errmsg(
"unique constraints on virtual generated columns are not supported") :
1164 errmsg(
"indexes on virtual generated columns are not supported")));
1176 if (
stmt->isconstraint && !quiet)
1178 const char *constraint_type;
1181 constraint_type =
"PRIMARY KEY";
1182 else if (
stmt->unique)
1183 constraint_type =
"UNIQUE";
1184 else if (
stmt->excludeOpNames)
1185 constraint_type =
"EXCLUDE";
1189 constraint_type = NULL;
1193 (
errmsg_internal(
"%s %s will create implicit index \"%s\" for table \"%s\"",
1194 is_alter_table ?
"ALTER TABLE / ADD" :
"CREATE TABLE /",
1211 flags = constr_flags = 0;
1212 if (
stmt->isconstraint)
1214 if (skip_build || concurrent || partitioned)
1216 if (
stmt->if_not_exists)
1229 if (partitioned &&
stmt->relation && !
stmt->relation->inh)
1237 if (
stmt->deferrable)
1239 if (
stmt->initdeferred)
1241 if (
stmt->iswithoutoverlaps)
1245 index_create(rel, indexRelationName, indexRelationId, parentIndexId,
1247 stmt->oldNumber, indexInfo, indexColNames,
1248 accessMethodId, tablespaceId,
1249 collationIds, opclassIds, opclassOptions,
1250 coloptions, NULL, reloptions,
1251 flags, constr_flags,
1253 &createdConstraintId);
1287 if (
stmt->idxcomment != NULL)
1302 if ((!
stmt->relation ||
stmt->relation->inh) && partdesc->
nparts > 0)
1304 int nparts = partdesc->
nparts;
1306 bool invalidate_parent =
false;
1329 if (total_parts < 0)
1342 memcpy(part_oids, partdesc->
oids,
sizeof(
Oid) * nparts);
1352 parentIndex =
index_open(indexRelationId, lockmode);
1365 for (
int i = 0;
i < nparts;
i++)
1367 Oid childRelid = part_oids[
i];
1369 Oid child_save_userid;
1370 int child_save_sec_context;
1371 int child_save_nestlevel;
1380 &child_save_sec_context);
1391 if (childrel->
rd_rel->relkind == RELKIND_FOREIGN_TABLE)
1395 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
1396 errmsg(
"cannot create unique index on partitioned table \"%s\"",
1398 errdetail(
"Table \"%s\" contains partitions that are foreign tables.",
1403 child_save_sec_context);
1414 foreach(cell, childidxs)
1460 createdConstraintId,
1464 invalidate_parent =
true;
1490 child_save_sec_context);
1519 root_save_sec_context);
1524 createdConstraintId,
1526 is_alter_table, check_rights,
1530 child_save_sec_context);
1538 invalidate_parent =
true;
1551 if (invalidate_parent)
1560 elog(
ERROR,
"cache lookup failed for index %u",
1656 const int progress_cols[] = {
1660 const int64 progress_vals[] = {
1763 limitXmin = snapshot->
xmin;
1855 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1856 errmsg(
"functions in index predicate must be marked IMMUTABLE")));
1873 Datum *opclassOptions,
1875 const List *attList,
1876 const List *exclusionOpNames,
1878 const char *accessMethodName,
1882 bool iswithoutoverlaps,
1884 int ddl_sec_context,
1885 int *ddl_save_nestlevel)
1892 int save_sec_context;
1895 if (exclusionOpNames)
1901 nextExclOp =
list_head(exclusionOpNames);
1912 if (iswithoutoverlaps)
1914 if (exclusionOpNames ==
NIL)
1930 foreach(lc, attList)
1939 if (attribute->
name != NULL)
1952 (
errcode(ERRCODE_UNDEFINED_COLUMN),
1953 errmsg(
"column \"%s\" named in key does not exist",
1957 (
errcode(ERRCODE_UNDEFINED_COLUMN),
1958 errmsg(
"column \"%s\" does not exist",
1963 atttype = attform->atttypid;
1964 attcollation = attform->attcollation;
1974 if (attn >= nkeycols)
1976 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1977 errmsg(
"expressions are not supported in included columns")));
2017 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2018 errmsg(
"functions in index expression must be marked IMMUTABLE")));
2022 typeOids[attn] = atttype;
2028 if (attn >= nkeycols)
2032 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2033 errmsg(
"including column does not support a collation")));
2036 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2037 errmsg(
"including column does not support an operator class")));
2040 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2041 errmsg(
"including column does not support ASC/DESC options")));
2044 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2045 errmsg(
"including column does not support NULLS FIRST/LAST options")));
2048 opclassOptions[attn] = (
Datum) 0;
2049 colOptions[attn] = 0;
2087 (
errcode(ERRCODE_INDETERMINATE_COLLATION),
2088 errmsg(
"could not determine which collation to use for index expression"),
2089 errhint(
"Use the COLLATE clause to set the collation explicitly.")));
2095 (
errcode(ERRCODE_DATATYPE_MISMATCH),
2096 errmsg(
"collations are not supported by type %s",
2100 collationOids[attn] = attcollation;
2162 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
2163 errmsg(
"operator %s is not commutative",
2165 errdetail(
"Only commutative operators can be used in exclusion constraints.")));
2174 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
2175 errmsg(
"operator %s is not a member of operator family \"%s\"",
2178 errdetail(
"The exclusion operator must be related to the index operator class for the constraint.")));
2183 nextExclOp =
lnext(exclusionOpNames, nextExclOp);
2185 else if (iswithoutoverlaps)
2191 if (attn == nkeycols - 1)
2206 colOptions[attn] = 0;
2211 colOptions[attn] |= INDOPTION_DESC;
2216 colOptions[attn] |= INDOPTION_NULLS_FIRST;
2219 colOptions[attn] |= INDOPTION_NULLS_FIRST;
2226 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2227 errmsg(
"access method \"%s\" does not support ASC/DESC options",
2228 accessMethodName)));
2231 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2232 errmsg(
"access method \"%s\" does not support NULLS FIRST/LAST options",
2233 accessMethodName)));
2241 opclassOptions[attn] =
2243 NULL, NULL,
false,
false);
2246 opclassOptions[attn] = (
Datum) 0;
2260 const char *accessMethodName,
Oid accessMethodId)
2275 (
errcode(ERRCODE_UNDEFINED_OBJECT),
2276 errmsg(
"data type %s has no default operator class for access method \"%s\"",
2278 errhint(
"You must specify an operator class for the index or define a default operator class for the data type.")));
2306 (
errcode(ERRCODE_UNDEFINED_OBJECT),
2307 errmsg(
"operator class \"%s\" does not exist for access method \"%s\"",
2308 opcname, accessMethodName)));
2314 (
errcode(ERRCODE_UNDEFINED_OBJECT),
2315 errmsg(
"operator class \"%s\" does not exist for access method \"%s\"",
2323 opClassId = opform->oid;
2324 opInputType = opform->opcintype;
2328 (
errcode(ERRCODE_DATATYPE_MISMATCH),
2329 errmsg(
"operator class \"%s\" does not accept data type %s",
2348 int ncompatible = 0;
2349 int ncompatiblepreferred = 0;
2376 Anum_pg_opclass_opcmethod,
2388 if (!opclass->opcdefault)
2390 if (opclass->opcintype == type_id)
2393 result = opclass->oid;
2395 else if (nexact == 0 &&
2400 ncompatiblepreferred++;
2401 result = opclass->oid;
2403 else if (ncompatiblepreferred == 0)
2406 result = opclass->oid;
2419 errmsg(
"there are multiple default operator classes for data type %s",
2423 ncompatiblepreferred == 1 ||
2424 (ncompatiblepreferred == 0 && ncompatible == 1))
2467 errcode(ERRCODE_UNDEFINED_OBJECT),
2471 errdetail(
"Could not translate compare type %d for operator family \"%s\" of access method \"%s\".",
2480 rhstype = opcintype;
2486 errcode(ERRCODE_UNDEFINED_OBJECT),
2490 errdetail(
"There is no suitable operator in operator family \"%s\" for access method \"%s\".",
2526 name1chars = strlen(name1);
2529 name2chars = strlen(name2);
2535 overhead += strlen(
label) + 1;
2545 while (name1chars + name2chars > availchars)
2547 if (name1chars > name2chars)
2553 name1chars =
pg_mbcliplen(name1, name1chars, name1chars);
2555 name2chars =
pg_mbcliplen(name2, name2chars, name2chars);
2558 name =
palloc(name1chars + name2chars + overhead + 1);
2559 memcpy(
name, name1, name1chars);
2564 memcpy(
name + ndx, name2, name2chars);
2606 const char *
label,
Oid namespaceid,
2632 Anum_pg_class_relname,
2636 Anum_pg_class_relnamespace,
2652 if (!isconstraint ||
2659 snprintf(modlabel,
sizeof(modlabel),
"%s%d",
label, ++pass);
2674 const List *colnames,
const List *exclusionOpNames,
2675 bool primary,
bool isconstraint)
2688 else if (exclusionOpNames !=
NIL)
2696 else if (isconstraint)
2735 foreach(lc, colnames)
2737 const char *
name = (
const char *)
lfirst(lc);
2740 buf[buflen++] =
'_';
2747 buflen += strlen(
buf + buflen);
2767 foreach(lc, indexElems)
2770 const char *origname;
2771 const char *curname;
2778 else if (ielem->
name)
2779 origname = ielem->
name;
2791 foreach(lc2, result)
2793 if (strcmp(curname, (
char *)
lfirst(lc2)) == 0)
2804 memcpy(
buf, origname, nlen);
2805 strcpy(
buf + nlen, nbuf);
2827 bool concurrently =
false;
2829 char *tablespacename = NULL;
2832 foreach(lc,
stmt->params)
2836 if (strcmp(opt->
defname,
"verbose") == 0)
2838 else if (strcmp(opt->
defname,
"concurrently") == 0)
2840 else if (strcmp(opt->
defname,
"tablespace") == 0)
2844 (
errcode(ERRCODE_SYNTAX_ERROR),
2845 errmsg(
"unrecognized REINDEX option \"%s\"",
2852 "REINDEX CONCURRENTLY");
2862 if (tablespacename != NULL)
2903 "REINDEX DATABASE");
2907 elog(
ERROR,
"unrecognized object type: %d",
2952 if (relkind == RELKIND_PARTITIONED_INDEX)
2955 persistence != RELPERSISTENCE_TEMP)
2993 if (relId != oldRelId &&
OidIsValid(oldRelId))
3011 if (relkind != RELKIND_INDEX &&
3012 relkind != RELKIND_PARTITIONED_INDEX)
3014 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3029 if (relId != oldRelId)
3038 state->locked_table_oid = table_oid;
3077 (
errmsg(
"table \"%s\" has no indexes that can be reindexed concurrently",
3091 (
errmsg(
"table \"%s\" has no indexes to reindex",
3119 bool concurrent_warning =
false;
3120 bool tablespace_warning =
false;
3121 const char *objectName =
stmt->name;
3137 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3138 errmsg(
"cannot reindex system catalogs concurrently")));
3161 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3162 errmsg(
"can only reindex the currently open database")));
3176 "ReindexMultipleTables",
3188 Anum_pg_class_relnamespace,
3206 Oid relid = classtuple->oid;
3215 if (classtuple->relkind != RELKIND_RELATION &&
3216 classtuple->relkind != RELKIND_MATVIEW)
3220 if (classtuple->relpersistence == RELPERSISTENCE_TEMP &&
3240 if (classtuple->relisshared &&
3251 if (!concurrent_warning)
3253 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3254 errmsg(
"cannot reindex system catalogs concurrently, skipping all")));
3255 concurrent_warning =
true;
3265 bool skip_rel =
false;
3271 if (RELKIND_HAS_STORAGE(classtuple->relkind) &&
3284 if (!tablespace_warning)
3286 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
3287 errmsg(
"cannot move system relations, skipping all")));
3288 tablespace_warning =
true;
3303 if (relid == RelationRelationId)
3332 if (errinfo->
relkind == RELKIND_PARTITIONED_TABLE)
3333 errcontext(
"while reindexing partitioned table \"%s.%s\"",
3335 else if (errinfo->
relkind == RELKIND_PARTITIONED_INDEX)
3336 errcontext(
"while reindexing partitioned index \"%s.%s\"",
3359 Assert(RELKIND_HAS_PARTITIONS(relkind));
3369 errcallback.
arg = &errinfo;
3374 relkind == RELKIND_PARTITIONED_TABLE ?
3375 "REINDEX TABLE" :
"REINDEX INDEX");
3397 foreach(lc, inhoids)
3407 if (!RELKIND_HAS_STORAGE(partkind))
3410 Assert(partkind == RELKIND_INDEX ||
3411 partkind == RELKIND_RELATION);
3452 char relpersistence;
3492 Assert(!RELKIND_HAS_PARTITIONS(relkind));
3495 relpersistence != RELPERSISTENCE_TEMP)
3505 else if (relkind == RELKIND_INDEX)
3529 (
errmsg(
"table \"%s.%s\" was reindexed",
3569 typedef struct ReindexIndexInfo
3586 char *relationName = NULL;
3587 char *relationNamespace = NULL;
3589 const int progress_index[] = {
3595 int64 progress_vals[4];
3604 "ReindexConcurrent",
3628 case RELKIND_RELATION:
3629 case RELKIND_MATVIEW:
3630 case RELKIND_TOASTVALUE:
3642 heapRelationIds =
lappend_oid(heapRelationIds, relationOid);
3648 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3649 errmsg(
"cannot reindex system catalogs concurrently")));
3667 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3668 errmsg(
"cannot move system relation \"%s\"",
3678 if (!indexRelation->
rd_index->indisvalid)
3680 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
3681 errmsg(
"skipping reindex of invalid index \"%s.%s\"",
3684 errhint(
"Use DROP INDEX or REINDEX INDEX.")));
3685 else if (indexRelation->
rd_index->indisexclusion)
3687 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3688 errmsg(
"cannot reindex exclusion constraint index \"%s.%s\" concurrently, skipping",
3693 ReindexIndexInfo *
idx;
3699 idx->indexId = cellOid;
3713 Oid toastOid = heapRelation->
rd_rel->reltoastrelid;
3721 heapRelationIds =
lappend_oid(heapRelationIds, toastOid);
3731 if (!indexRelation->
rd_index->indisvalid)
3733 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
3734 errmsg(
"skipping reindex of invalid index \"%s.%s\"",
3737 errhint(
"Use DROP INDEX or REINDEX INDEX.")));
3740 ReindexIndexInfo *
idx;
3749 idx->indexId = cellOid;
3770 ReindexIndexInfo *
idx;
3778 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3779 errmsg(
"cannot reindex system catalogs concurrently")));
3789 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3790 errmsg(
"cannot reindex invalid index on TOAST table")));
3813 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3814 errmsg(
"cannot move system relation \"%s\"",
3830 idx->indexId = relationOid;
3838 case RELKIND_PARTITIONED_TABLE:
3839 case RELKIND_PARTITIONED_INDEX:
3843 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3844 errmsg(
"cannot reindex this type of relation concurrently")));
3855 if (indexIds ==
NIL)
3861 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3862 errmsg(
"cannot move non-shared relation to tablespace \"%s\"",
3892 foreach(lc, indexIds)
3894 char *concurrentName;
3896 ReindexIndexInfo *newidx;
3901 int save_sec_context;
3926#ifdef USE_INJECTION_POINTS
3937 if (indexRel->
rd_rel->relpersistence == RELPERSISTENCE_TEMP)
3938 elog(
ERROR,
"cannot reindex a temporary table concurrently");
3943 progress_vals[1] = 0;
3944 progress_vals[2] =
idx->indexId;
3945 progress_vals[3] =
idx->amId;
3957 heapRel->
rd_rel->relkind != RELKIND_TOASTVALUE)
3960 tablespaceid = indexRel->
rd_rel->reltablespace;
3980 newidx->indexId = newIndexId;
3981 newidx->safe =
idx->safe;
3982 newidx->tableId =
idx->tableId;
3983 newidx->amId =
idx->amId;
3985 newIndexIds =
lappend(newIndexIds, newidx);
3995 relationLocks =
lappend(relationLocks, lockrelid);
3998 relationLocks =
lappend(relationLocks, lockrelid);
4032 foreach(lc, heapRelationIds)
4044 relationLocks =
lappend(relationLocks, lockrelid);
4050 lockTags =
lappend(lockTags, heaplocktag);
4059 foreach(lc, relationLocks)
4090 foreach(lc, newIndexIds)
4092 ReindexIndexInfo *newidx =
lfirst(lc);
4118 progress_vals[2] = newidx->indexId;
4119 progress_vals[3] = newidx->amId;
4149 foreach(lc, newIndexIds)
4151 ReindexIndexInfo *newidx =
lfirst(lc);
4182 progress_vals[2] = newidx->indexId;
4183 progress_vals[3] = newidx->amId;
4192 limitXmin = snapshot->
xmin;
4241 forboth(lc, indexIds, lc2, newIndexIds)
4243 ReindexIndexInfo *oldidx =
lfirst(lc);
4244 ReindexIndexInfo *newidx =
lfirst(lc2);
4314 foreach(lc, indexIds)
4316 ReindexIndexInfo *oldidx =
lfirst(lc);
4361 foreach(lc, indexIds)
4366 object.
classId = RelationRelationId;
4367 object.objectId =
idx->indexId;
4368 object.objectSubId = 0;
4387 foreach(lc, relationLocks)
4400 if (relkind == RELKIND_INDEX)
4402 (
errmsg(
"index \"%s.%s\" was reindexed",
4403 relationNamespace, relationName),
4408 foreach(lc, newIndexIds)
4411 Oid indOid =
idx->indexId;
4414 (
errmsg(
"index \"%s.%s\" was reindexed",
4421 (
errmsg(
"table \"%s.%s\" was reindexed",
4422 relationNamespace, relationName),
4452 Assert(partitionIdx->
rd_rel->relkind == RELKIND_INDEX ||
4453 partitionIdx->
rd_rel->relkind == RELKIND_PARTITIONED_INDEX);
4460 Anum_pg_inherits_inhrelid,
4464 Anum_pg_inherits_inhseqno,
4506 if (inhForm->inhparent != parentOid)
4509 elog(
ERROR,
"bogus pg_inherit row: inhrelid %u inhparent %u",
4510 inhForm->inhrelid, inhForm->inhparent);
4583 elog(
ERROR,
"cache lookup failed for relation %u", relationId);
Datum idx(PG_FUNCTION_ARGS)
bool has_privs_of_role(Oid member, Oid role)
void aclcheck_error(AclResult aclerr, ObjectType objtype, const char *objectname)
AclResult object_aclcheck(Oid classid, Oid objectid, Oid roleid, AclMode mode)
bool object_ownercheck(Oid classid, Oid objectid, Oid roleid)
AclResult pg_class_aclcheck(Oid table_oid, Oid roleid, AclMode mode)
IndexAmRoutine * GetIndexAmRoutine(Oid amhandler)
StrategyNumber IndexAmTranslateCompareType(CompareType cmptype, Oid amoid, Oid opfamily, bool missing_ok)
bytea *(* amoptions_function)(Datum reloptions, bool validate)
char * get_am_name(Oid amOid)
void free_attrmap(AttrMap *map)
AttrMap * build_attrmap_by_name(TupleDesc indesc, TupleDesc outdesc, bool missing_ok)
#define InvalidAttrNumber
char * get_tablespace_name(Oid spc_oid)
Oid get_tablespace_oid(const char *tablespacename, bool missing_ok)
Oid GetDefaultTablespace(char relpersistence, bool partitioned)
void pgstat_progress_start_command(ProgressCommandType cmdtype, Oid relid)
void pgstat_progress_incr_param(int index, int64 incr)
void pgstat_progress_update_param(int index, int64 val)
void pgstat_progress_update_multi_param(int nparam, const int *index, const int64 *val)
void pgstat_progress_end_command(void)
@ PROGRESS_COMMAND_CREATE_INDEX
int bms_next_member(const Bitmapset *a, int prevbit)
bool bms_is_member(int x, const Bitmapset *a)
#define OidIsValid(objectId)
bool IsToastNamespace(Oid namespaceId)
bool IsSystemRelation(Relation relation)
bool IsCatalogRelationOid(Oid relid)
bool IsSystemClass(Oid relid, Form_pg_class reltuple)
bool contain_mutable_functions_after_planning(Expr *expr)
char * defGetString(DefElem *def)
bool defGetBoolean(DefElem *def)
void performMultipleDeletions(const ObjectAddresses *objects, DropBehavior behavior, int flags)
void add_exact_object_address(const ObjectAddress *object, ObjectAddresses *addrs)
ObjectAddresses * new_object_addresses(void)
@ DEPENDENCY_PARTITION_PRI
@ DEPENDENCY_PARTITION_SEC
#define PERFORM_DELETION_CONCURRENT_LOCK
#define PERFORM_DELETION_INTERNAL
int errmsg_internal(const char *fmt,...)
int errdetail(const char *fmt,...)
ErrorContextCallback * error_context_stack
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
void EventTriggerCollectSimpleCommand(ObjectAddress address, ObjectAddress secondaryObject, Node *parsetree)
#define palloc_object(type)
#define palloc_array(type, count)
Datum FunctionCall2Coll(FmgrInfo *flinfo, Oid collation, Datum arg1, Datum arg2)
void fmgr_info(Oid functionId, FmgrInfo *finfo)
void systable_endscan(SysScanDesc sysscan)
HeapTuple systable_getnext(SysScanDesc sysscan)
SysScanDesc systable_beginscan(Relation heapRelation, Oid indexId, bool indexOK, Snapshot snapshot, int nkeys, ScanKey key)
bool allowSystemTableMods
int NewGUCNestLevel(void)
void RestrictSearchPath(void)
void AtEOXact_GUC(bool isCommit, int nestLevel)
int set_config_option(const char *name, const char *value, GucContext context, GucSource source, GucAction action, bool changeVal, int elevel, bool is_reload)
Assert(PointerIsAligned(start, uint64))
HeapTuple heap_getnext(TableScanDesc sscan, ScanDirection direction)
HeapTuple heap_copytuple(HeapTuple tuple)
bool heap_attisnull(HeapTuple tup, int attnum, TupleDesc tupleDesc)
void heap_freetuple(HeapTuple htup)
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
void validate_index(Oid heapId, Oid indexId, Snapshot snapshot)
Oid IndexGetRelation(Oid indexId, bool missing_ok)
void index_concurrently_set_dead(Oid heapId, Oid indexId)
Oid index_create(Relation heapRelation, const char *indexRelationName, Oid indexRelationId, Oid parentIndexRelid, Oid parentConstraintId, RelFileNumber relFileNumber, IndexInfo *indexInfo, const List *indexColNames, Oid accessMethodId, Oid tableSpaceId, const Oid *collationIds, const Oid *opclassIds, const Datum *opclassOptions, const int16 *coloptions, const NullableDatum *stattargets, Datum reloptions, bits16 flags, bits16 constr_flags, bool allow_system_table_mods, bool is_internal, Oid *constraintId)
void index_concurrently_swap(Oid newIndexId, Oid oldIndexId, const char *oldName)
void index_set_state_flags(Oid indexId, IndexStateFlagsAction action)
bool CompareIndexInfo(const IndexInfo *info1, const IndexInfo *info2, const Oid *collations1, const Oid *collations2, const Oid *opfamilies1, const Oid *opfamilies2, const AttrMap *attmap)
bool reindex_relation(const ReindexStmt *stmt, Oid relid, int flags, const ReindexParams *params)
IndexInfo * BuildIndexInfo(Relation index)
Oid index_concurrently_create_copy(Relation heapRelation, Oid oldIndexId, Oid tablespaceOid, const char *newName)
void index_check_primary_key(Relation heapRel, const IndexInfo *indexInfo, bool is_alter_table, const IndexStmt *stmt)
void index_concurrently_build(Oid heapRelationId, Oid indexRelationId)
void reindex_index(const ReindexStmt *stmt, Oid indexId, bool skip_constraint_checks, char persistence, const ReindexParams *params)
#define INDEX_CREATE_IS_PRIMARY
#define INDEX_CREATE_IF_NOT_EXISTS
#define REINDEX_REL_PROCESS_TOAST
#define INDEX_CREATE_PARTITIONED
#define REINDEXOPT_CONCURRENTLY
#define REINDEXOPT_MISSING_OK
#define INDEX_CREATE_INVALID
#define INDEX_CONSTR_CREATE_WITHOUT_OVERLAPS
#define INDEX_CREATE_ADD_CONSTRAINT
#define INDEX_CREATE_SKIP_BUILD
#define INDEX_CONSTR_CREATE_DEFERRABLE
#define REINDEXOPT_REPORT_PROGRESS
#define INDEX_CONSTR_CREATE_INIT_DEFERRED
#define INDEX_CREATE_CONCURRENT
#define REINDEXOPT_VERBOSE
#define REINDEX_REL_CHECK_CONSTRAINTS
void index_close(Relation relation, LOCKMODE lockmode)
Relation index_open(Oid relationId, LOCKMODE lockmode)
static bool ReindexRelationConcurrently(const ReindexStmt *stmt, Oid relationOid, const ReindexParams *params)
void ExecReindex(ParseState *pstate, const ReindexStmt *stmt, bool isTopLevel)
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)
static void set_indexsafe_procflags(void)
char * ChooseRelationName(const char *name1, const char *name2, const char *label, Oid namespaceid, bool isconstraint)
static void reindex_error_callback(void *arg)
static void ComputeIndexAttrs(IndexInfo *indexInfo, Oid *typeOids, Oid *collationOids, Oid *opclassOids, Datum *opclassOptions, int16 *colOptions, const List *attList, const List *exclusionOpNames, Oid relId, const char *accessMethodName, Oid accessMethodId, bool amcanorder, bool isconstraint, bool iswithoutoverlaps, Oid ddl_userid, int ddl_sec_context, int *ddl_save_nestlevel)
static void ReindexIndex(const ReindexStmt *stmt, const ReindexParams *params, bool isTopLevel)
void IndexSetParentIndex(Relation partitionIdx, Oid parentOid)
char * makeObjectName(const char *name1, const char *name2, const char *label)
Oid GetDefaultOpClass(Oid type_id, Oid am_id)
static char * ChooseIndexNameAddition(const List *colnames)
static void ReindexMultipleTables(const ReindexStmt *stmt, const ReindexParams *params)
static bool CompareOpclassOptions(const Datum *opts1, const Datum *opts2, int natts)
static void update_relispartition(Oid relationId, bool newval)
bool CheckIndexCompatible(Oid oldId, const char *accessMethodName, const List *attributeList, const List *exclusionOpNames, bool isWithoutOverlaps)
void WaitForOlderSnapshots(TransactionId limitXmin, bool progress)
Oid ResolveOpClass(const List *opclass, Oid attrType, const char *accessMethodName, Oid accessMethodId)
static void ReindexPartitions(const ReindexStmt *stmt, Oid relid, const ReindexParams *params, bool isTopLevel)
struct ReindexErrorInfo ReindexErrorInfo
static Oid ReindexTable(const ReindexStmt *stmt, const ReindexParams *params, bool isTopLevel)
static void CheckPredicate(Expr *predicate)
static void ReindexMultipleInternal(const ReindexStmt *stmt, const List *relids, const ReindexParams *params)
static void RangeVarCallbackForReindexIndex(const RangeVar *relation, Oid relId, Oid oldRelId, void *arg)
static List * ChooseIndexColumnNames(const List *indexElems)
void GetOperatorFromCompareType(Oid opclass, Oid rhstype, CompareType cmptype, Oid *opid, StrategyNumber *strat)
static char * ChooseIndexName(const char *tabname, Oid namespaceId, const List *colnames, const List *exclusionOpNames, bool primary, bool isconstraint)
void CatalogTupleUpdate(Relation heapRel, ItemPointer otid, HeapTuple tup)
void CatalogTupleDelete(Relation heapRel, ItemPointer tid)
#define INJECTION_POINT(name, arg)
void CacheInvalidateRelcacheByRelid(Oid relid)
List * lcons_oid(Oid datum, List *list)
List * lappend(List *list, void *datum)
List * list_concat_copy(const List *list1, const List *list2)
List * lappend_oid(List *list, Oid datum)
void list_free(List *list)
void UnlockTuple(Relation relation, const ItemPointerData *tid, LOCKMODE lockmode)
void UnlockRelationOid(Oid relid, LOCKMODE lockmode)
void WaitForLockersMultiple(List *locktags, LOCKMODE lockmode, bool progress)
void LockRelationIdForSession(LockRelId *relid, LOCKMODE lockmode)
void LockRelationOid(Oid relid, LOCKMODE lockmode)
void WaitForLockers(LOCKTAG heaplocktag, LOCKMODE lockmode, bool progress)
void UnlockRelationIdForSession(LockRelId *relid, LOCKMODE lockmode)
bool VirtualXactLock(VirtualTransactionId vxid, bool wait)
#define VirtualTransactionIdIsValid(vxid)
#define SET_LOCKTAG_RELATION(locktag, dboid, reloid)
#define VirtualTransactionIdEquals(vxid1, vxid2)
#define SetInvalidVirtualTransactionId(vxid)
#define AccessExclusiveLock
#define InplaceUpdateTupleLock
#define ShareUpdateExclusiveLock
char * get_rel_name(Oid relid)
Oid get_opclass_method(Oid opclass)
char get_rel_persistence(Oid relid)
bool get_index_isvalid(Oid index_oid)
Oid get_opclass_input_type(Oid opclass)
Oid get_opclass_family(Oid opclass)
Oid get_opfamily_member_for_cmptype(Oid opfamily, Oid lefttype, Oid righttype, CompareType cmptype)
bool get_opclass_opfamily_and_input_type(Oid opclass, Oid *opfamily, Oid *opcintype)
char * get_database_name(Oid dbid)
char * get_opname(Oid opno)
Datum get_attoptions(Oid relid, int16 attnum)
char get_rel_relkind(Oid relid)
Oid get_rel_namespace(Oid relid)
RegProcedure get_opcode(Oid opno)
int get_op_opfamily_strategy(Oid opno, Oid opfamily)
Oid get_opfamily_member(Oid opfamily, Oid lefttype, Oid righttype, int16 strategy)
char * get_opfamily_name(Oid opfid, bool missing_ok)
bool type_is_collatable(Oid typid)
Oid get_opfamily_method(Oid opfid)
Oid getBaseType(Oid typid)
char * get_namespace_name(Oid nspid)
Oid get_commutator(Oid opno)
void op_input_types(Oid opno, Oid *lefttype, Oid *righttype)
bool LWLockAcquire(LWLock *lock, LWLockMode mode)
void LWLockRelease(LWLock *lock)
IndexInfo * makeIndexInfo(int numattrs, int numkeyattrs, Oid amoid, List *expressions, List *predicates, bool unique, bool nulls_not_distinct, bool isready, bool concurrent, bool summarizing, bool withoutoverlaps)
List * make_ands_implicit(Expr *clause)
int pg_mbcliplen(const char *mbstr, int len, int limit)
char * pstrdup(const char *in)
void pfree(void *pointer)
void MemoryContextDelete(MemoryContext context)
MemoryContext PortalContext
#define AllocSetContextCreate
#define ALLOCSET_DEFAULT_SIZES
#define ALLOCSET_SMALL_SIZES
#define IsBootstrapProcessingMode()
#define SECURITY_RESTRICTED_OPERATION
#define CHECK_FOR_INTERRUPTS()
void GetUserIdAndSecContext(Oid *userid, int *sec_context)
void SetUserIdAndSecContext(Oid userid, int sec_context)
Oid OpclassnameGetOpcid(Oid amid, const char *opcname)
char * NameListToString(const List *names)
Oid LookupExplicitNamespace(const char *nspname, bool missing_ok)
bool isTempNamespace(Oid namespaceId)
Oid get_collation_oid(List *collname, bool missing_ok)
void DeconstructQualifiedName(const List *names, char **nspname_p, char **objname_p)
Oid get_namespace_oid(const char *nspname, bool missing_ok)
Oid RangeVarGetRelidExtended(const RangeVar *relation, LOCKMODE lockmode, uint32 flags, RangeVarGetRelidCallback callback, void *callback_arg)
Oid exprType(const Node *expr)
Oid exprCollation(const Node *expr)
#define IsA(nodeptr, _type_)
const ObjectAddress InvalidObjectAddress
#define ObjectAddressSet(addr, class_id, object_id)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
TYPCATEGORY TypeCategory(Oid type)
bool IsBinaryCoercible(Oid srctype, Oid targettype)
bool IsPreferredType(TYPCATEGORY category, Oid type)
int parser_errposition(ParseState *pstate, int location)
Oid compatible_oper_opid(List *op, Oid arg1, Oid arg2, bool noError)
IndexStmt * generateClonedIndexStmt(RangeVar *heapRel, Relation source_idx, const AttrMap *attmap, Oid *constraintOid)
@ PARTITION_STRATEGY_HASH
@ REINDEX_OBJECT_DATABASE
PartitionKey RelationGetPartitionKey(Relation rel)
PartitionDesc RelationGetPartitionDesc(Relation rel, bool omit_detached)
FormData_pg_am * Form_pg_am
FormData_pg_attribute * Form_pg_attribute
static void fix_dependencies(ArchiveHandle *AH)
int errdetail_relkind_not_supported(char relkind)
FormData_pg_class * Form_pg_class
Oid get_relation_idx_constraint_oid(Oid relationId, Oid indexId)
void ConstraintSetParentConstraint(Oid childConstrId, Oid parentConstrId, Oid childTableId)
bool ConstraintNameExists(const char *conname, Oid namespaceid)
void recordDependencyOn(const ObjectAddress *depender, const ObjectAddress *referenced, DependencyType behavior)
long deleteDependencyRecordsForClass(Oid classId, Oid objectId, Oid refclassId, char deptype)
FormData_pg_index * Form_pg_index
List * find_all_inheritors(Oid parentrelId, LOCKMODE lockmode, List **numparents)
void StoreSingleInheritance(Oid relationId, Oid parentOid, int32 seqNumber)
bool has_superclass(Oid relationId)
FormData_pg_inherits * Form_pg_inherits
static int list_length(const List *l)
#define forboth(cell1, list1, cell2, list2)
#define list_make1_oid(x1)
static ListCell * list_head(const List *l)
static ListCell * lnext(const List *l, const ListCell *c)
FormData_pg_opclass * Form_pg_opclass
const char * pg_rusage_show(const PGRUsage *ru0)
void pg_rusage_init(PGRUsage *ru0)
size_t strlcpy(char *dst, const char *src, size_t siz)
static bool DatumGetBool(Datum X)
static Datum PointerGetDatum(const void *X)
static Datum ObjectIdGetDatum(Oid X)
static Pointer DatumGetPointer(Datum X)
static Datum CStringGetDatum(const char *X)
static Datum Int32GetDatum(int32 X)
#define PROC_IS_AUTOVACUUM
VirtualTransactionId * GetCurrentVirtualXIDs(TransactionId limitXmin, bool excludeXmin0, bool allDbs, int excludeVacuum, int *nvxids)
PGPROC * ProcNumberGetProc(ProcNumber procNumber)
#define PROGRESS_CREATEIDX_PHASE_WAIT_4
#define PROGRESS_CREATEIDX_PHASE_BUILD
#define PROGRESS_CREATEIDX_PARTITIONS_DONE
#define PROGRESS_CREATEIDX_PHASE_WAIT_1
#define PROGRESS_CREATEIDX_COMMAND_CREATE_CONCURRENTLY
#define PROGRESS_CREATEIDX_ACCESS_METHOD_OID
#define PROGRESS_WAITFOR_DONE
#define PROGRESS_CREATEIDX_PHASE_WAIT_3
#define PROGRESS_WAITFOR_TOTAL
#define PROGRESS_CREATEIDX_COMMAND_REINDEX_CONCURRENTLY
#define PROGRESS_CREATEIDX_COMMAND_CREATE
#define PROGRESS_WAITFOR_CURRENT_PID
#define PROGRESS_CREATEIDX_PHASE_WAIT_2
#define PROGRESS_CREATEIDX_PHASE
#define PROGRESS_CREATEIDX_PHASE_VALIDATE_IDXSCAN
#define PROGRESS_CREATEIDX_PHASE_WAIT_5
#define PROGRESS_CREATEIDX_INDEX_OID
#define PROGRESS_CREATEIDX_PARTITIONS_TOTAL
#define PROGRESS_CREATEIDX_COMMAND
char * format_operator(Oid operator_oid)
#define RelationGetRelid(relation)
#define RelationGetDescr(relation)
#define RelationGetRelationName(relation)
#define RELATION_IS_OTHER_TEMP(relation)
#define RelationGetNamespace(relation)
List * RelationGetIndexList(Relation relation)
List * RelationGetIndexPredicate(Relation relation)
List * RelationGetIndexExpressions(Relation relation)
void RelationGetExclusionInfo(Relation indexRelation, Oid **operators, Oid **procs, uint16 **strategies)
bytea * index_reloptions(amoptions_function amoptions, Datum reloptions, bool validate)
Datum transformRelOptions(Datum oldOptions, List *defList, const char *nameSpace, const char *const validnsps[], bool acceptOidsOff, bool isReset)
#define RelFileNumberIsValid(relnumber)
void ScanKeyInit(ScanKey entry, AttrNumber attributeNumber, StrategyNumber strategy, RegProcedure procedure, Datum argument)
Snapshot GetTransactionSnapshot(void)
void UnregisterSnapshot(Snapshot snapshot)
void PushActiveSnapshot(Snapshot snapshot)
bool ActiveSnapshotSet(void)
Snapshot RegisterSnapshot(Snapshot snapshot)
void PopActiveSnapshot(void)
#define InitDirtySnapshot(snapshotdata)
void relation_close(Relation relation, LOCKMODE lockmode)
Relation relation_open(Oid relationId, LOCKMODE lockmode)
#define HTEqualStrategyNumber
#define BTEqualStrategyNumber
#define ERRCODE_DUPLICATE_OBJECT
struct ErrorContextCallback * previous
void(* callback)(void *arg)
amoptions_function amoptions
amgettuple_function amgettuple
SortByNulls nulls_ordering
uint16 * ii_ExclusionStrats
AttrNumber ii_IndexAttrNumbers[INDEX_MAX_KEYS]
Oid values[FLEXIBLE_ARRAY_MEMBER]
#define FirstLowInvalidHeapAttributeNumber
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCacheLockedCopy1(int cacheId, Datum key1)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
HeapTuple SearchSysCache3(int cacheId, Datum key1, Datum key2, Datum key3)
HeapTuple SearchSysCacheAttName(Oid relid, const char *attname)
Datum SysCacheGetAttrNotNull(int cacheId, HeapTuple tup, AttrNumber attributeNumber)
#define SearchSysCacheExists1(cacheId, key1)
Relation try_table_open(Oid relationId, LOCKMODE lockmode)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
TableScanDesc table_beginscan_catalog(Relation relation, int nkeys, ScanKeyData *key)
static void table_endscan(TableScanDesc scan)
void CheckTableNotInUse(Relation rel, const char *stmt)
void SetRelationHasSubclass(Oid relationId, bool relhassubclass)
void RangeVarCallbackMaintainsTable(const RangeVar *relation, Oid relId, Oid oldRelId, void *arg)
#define InvalidTransactionId
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)
void pull_varattnos(Node *node, Index varno, Bitmapset **varattnos)
void CommandCounterIncrement(void)
void PreventInTransactionBlock(bool isTopLevel, const char *stmtType)
void StartTransactionCommand(void)
void CommitTransactionCommand(void)