63 #include "utils/fmgroids.h"
83 Datum *opclassOptions,
86 const List *exclusionOpNames,
88 const char *accessMethodName,
92 bool iswithoutoverlaps,
95 int *ddl_save_nestlevel);
97 const List *colnames,
const List *exclusionOpNames,
98 bool primary,
bool isconstraint);
179 const char *accessMethodName,
180 const List *attributeList,
181 const List *exclusionOpNames,
182 bool isWithoutOverlaps)
188 Datum *opclassOptions;
199 int numberOfAttributes;
215 isconstraint =
false;
218 Assert(numberOfAttributes > 0);
225 (
errcode(ERRCODE_UNDEFINED_OBJECT),
226 errmsg(
"access method \"%s\" does not exist",
229 accessMethodId = accessMethodForm->oid;
244 indexInfo =
makeIndexInfo(numberOfAttributes, numberOfAttributes,
245 accessMethodId,
NIL,
NIL,
false,
false,
246 false,
false, amsummarizing, isWithoutOverlaps);
253 typeIds, collationIds, opclassIds, opclassOptions,
254 coloptions, attributeList,
255 exclusionOpNames, relationId,
256 accessMethodName, accessMethodId,
257 amcanorder, isconstraint, isWithoutOverlaps,
InvalidOid,
263 elog(
ERROR,
"cache lookup failed for index %u", oldId);
272 indexForm->indisvalid))
279 old_natts = indexForm->indnkeyatts;
280 Assert(old_natts == numberOfAttributes);
288 ret = (memcmp(old_indclass->
values, opclassIds, old_natts *
sizeof(
Oid)) == 0 &&
289 memcmp(old_indcollation->
values, collationIds, old_natts *
sizeof(
Oid)) == 0);
298 for (
i = 0;
i < old_natts;
i++)
313 for (
i = 0;
i < old_natts;
i++)
318 pfree(oldOpclassOptions);
330 old_natts *
sizeof(
Oid)) == 0;
335 for (
i = 0;
i < old_natts && ret;
i++)
341 if ((IsPolymorphicType(left) || IsPolymorphicType(right)) &&
366 if (!opts1 && !opts2)
369 for (
i = 0;
i < natts;
i++)
374 if (opt1 == (
Datum) 0)
376 if (opt2 == (
Datum) 0)
381 else if (opt2 == (
Datum) 0)
442 for (
i = 0;
i < n_old_snapshots;
i++)
451 int n_newer_snapshots;
460 for (
j =
i;
j < n_old_snapshots;
j++)
464 for (k = 0; k < n_newer_snapshots; k++)
470 if (k >= n_newer_snapshots)
473 pfree(newer_snapshots);
540 Oid parentConstraintId,
544 bool check_not_in_use,
549 char *indexRelationName;
550 char *accessMethodName;
554 Datum *opclassOptions;
560 List *allIndexParams;
566 bool amissummarizing;
576 int numberOfAttributes;
577 int numberOfKeyAttributes;
584 Oid root_save_userid;
585 int root_save_sec_context;
586 int root_save_nestlevel;
597 if (
stmt->reset_default_tblspc)
647 stmt->indexIncludingParams);
650 if (numberOfKeyAttributes <= 0)
652 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
653 errmsg(
"must specify at least one column")));
656 (
errcode(ERRCODE_TOO_MANY_COLUMNS),
657 errmsg(
"cannot use more than %d columns in an index",
693 exclusion =
stmt->excludeOpNames ||
stmt->iswithoutoverlaps;
696 switch (rel->
rd_rel->relkind)
698 case RELKIND_RELATION:
699 case RELKIND_MATVIEW:
700 case RELKIND_PARTITIONED_TABLE:
705 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
706 errmsg(
"cannot create index on relation \"%s\"",
720 partitioned = rel->
rd_rel->relkind == RELKIND_PARTITIONED_TABLE;
729 if (
stmt->concurrent)
731 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
732 errmsg(
"cannot create index on partitioned table \"%s\" concurrently",
741 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
742 errmsg(
"cannot create indexes on temporary tables of other sessions")));
750 if (check_not_in_use)
763 aclresult =
object_aclcheck(NamespaceRelationId, namespaceId, root_save_userid,
774 if (
stmt->tableSpace)
779 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
780 errmsg(
"cannot specify default tablespace for partitioned relations")));
795 aclresult =
object_aclcheck(TableSpaceRelationId, tablespaceId, root_save_userid,
807 if (rel->
rd_rel->relisshared)
808 tablespaceId = GLOBALTABLESPACE_OID;
809 else if (tablespaceId == GLOBALTABLESPACE_OID)
811 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
812 errmsg(
"only shared relations can be placed in pg_global tablespace")));
822 indexRelationName =
stmt->idxname;
823 if (indexRelationName == NULL)
827 stmt->excludeOpNames,
834 accessMethodName =
stmt->accessMethod;
842 if (strcmp(accessMethodName,
"rtree") == 0)
845 (
errmsg(
"substituting access method \"gist\" for obsolete method \"rtree\"")));
846 accessMethodName =
"gist";
852 (
errcode(ERRCODE_UNDEFINED_OBJECT),
853 errmsg(
"access method \"%s\" does not exist",
857 accessMethodId = accessMethodForm->oid;
865 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
866 errmsg(
"access method \"%s\" does not support unique indexes",
870 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
871 errmsg(
"access method \"%s\" does not support included columns",
875 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
876 errmsg(
"access method \"%s\" does not support multicolumn indexes",
878 if (exclusion && amRoutine->
amgettuple == NULL)
880 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
881 errmsg(
"access method \"%s\" does not support exclusion constraints",
883 if (
stmt->iswithoutoverlaps && strcmp(accessMethodName,
"gist") != 0)
885 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
886 errmsg(
"access method \"%s\" does not support WITHOUT OVERLAPS constraints",
899 if (
stmt->whereClause)
906 NULL, NULL,
false,
false);
916 numberOfKeyAttributes,
921 stmt->nulls_not_distinct,
925 stmt->iswithoutoverlaps);
933 typeIds, collationIds, opclassIds, opclassOptions,
934 coloptions, allIndexParams,
935 stmt->excludeOpNames, tableId,
936 accessMethodName, accessMethodId,
937 amcanorder,
stmt->isconstraint,
stmt->iswithoutoverlaps,
938 root_save_userid, root_save_sec_context,
939 &root_save_nestlevel);
957 if (partitioned && (
stmt->unique || exclusion))
960 const char *constraint_type;
964 constraint_type =
"PRIMARY KEY";
965 else if (
stmt->unique)
966 constraint_type =
"UNIQUE";
967 else if (
stmt->excludeOpNames)
968 constraint_type =
"EXCLUDE";
972 constraint_type = NULL;
979 for (
i = 0;
i <
key->partnatts;
i++)
998 key->partopcintype[
i],
999 key->partopcintype[
i],
1002 elog(
ERROR,
"missing operator %d(%u,%u) in partition opfamily %u",
1003 eq_strategy,
key->partopcintype[
i],
key->partopcintype[
i],
1004 key->partopfamily[
i]);
1014 if (
stmt->unique && !
stmt->iswithoutoverlaps && accessMethodId != BTREE_AM_OID)
1016 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1017 errmsg(
"cannot match partition key to an index using access method \"%s\"",
1018 accessMethodName)));
1024 if (
key->partattrs[
i] == 0)
1026 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1027 errmsg(
"unsupported %s constraint with partition key definition",
1029 errdetail(
"%s constraints cannot be used when partition keys include expressions.",
1044 if (
key->partcollation[
i] != collationIds[
j])
1053 if (
stmt->unique && !
stmt->iswithoutoverlaps)
1062 if (ptkey_eqop == idx_eqop)
1078 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1079 errmsg(
"cannot match partition key to index on column \"%s\" using non-equal operator \"%s\"",
1092 key->partattrs[
i] - 1);
1094 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1095 errmsg(
"unique constraint on partitioned table must include all partitioning columns"),
1096 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")));
1133 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1134 errmsg(
"index creation on system columns is not supported")));
1146 if (
stmt->isconstraint && !quiet)
1148 const char *constraint_type;
1151 constraint_type =
"PRIMARY KEY";
1152 else if (
stmt->unique)
1153 constraint_type =
"UNIQUE";
1154 else if (
stmt->excludeOpNames)
1155 constraint_type =
"EXCLUDE";
1159 constraint_type = NULL;
1163 (
errmsg_internal(
"%s %s will create implicit index \"%s\" for table \"%s\"",
1164 is_alter_table ?
"ALTER TABLE / ADD" :
"CREATE TABLE /",
1181 flags = constr_flags = 0;
1182 if (
stmt->isconstraint)
1184 if (skip_build || concurrent || partitioned)
1186 if (
stmt->if_not_exists)
1199 if (partitioned &&
stmt->relation && !
stmt->relation->inh)
1207 if (
stmt->deferrable)
1209 if (
stmt->initdeferred)
1211 if (
stmt->iswithoutoverlaps)
1215 index_create(rel, indexRelationName, indexRelationId, parentIndexId,
1217 stmt->oldNumber, indexInfo, indexColNames,
1218 accessMethodId, tablespaceId,
1219 collationIds, opclassIds, opclassOptions,
1220 coloptions, NULL, reloptions,
1221 flags, constr_flags,
1223 &createdConstraintId);
1257 if (
stmt->idxcomment != NULL)
1272 if ((!
stmt->relation ||
stmt->relation->inh) && partdesc->
nparts > 0)
1274 int nparts = partdesc->
nparts;
1276 bool invalidate_parent =
false;
1299 if (total_parts < 0)
1312 memcpy(part_oids, partdesc->
oids,
sizeof(
Oid) * nparts);
1322 parentIndex =
index_open(indexRelationId, lockmode);
1335 for (
int i = 0;
i < nparts;
i++)
1337 Oid childRelid = part_oids[
i];
1339 Oid child_save_userid;
1340 int child_save_sec_context;
1341 int child_save_nestlevel;
1350 &child_save_sec_context);
1361 if (childrel->
rd_rel->relkind == RELKIND_FOREIGN_TABLE)
1365 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
1366 errmsg(
"cannot create unique index on partitioned table \"%s\"",
1368 errdetail(
"Table \"%s\" contains partitions that are foreign tables.",
1373 child_save_sec_context);
1384 foreach(cell, childidxs)
1430 createdConstraintId,
1434 invalidate_parent =
true;
1460 child_save_sec_context);
1469 bool found_whole_row;
1507 if (found_whole_row)
1508 elog(
ERROR,
"cannot convert whole-row table reference");
1515 if (found_whole_row)
1516 elog(
ERROR,
"cannot convert whole-row table reference");
1524 root_save_sec_context);
1529 createdConstraintId,
1531 is_alter_table, check_rights,
1535 child_save_sec_context);
1543 invalidate_parent =
true;
1556 if (invalidate_parent)
1565 elog(
ERROR,
"cache lookup failed for index %u",
1661 const int progress_cols[] = {
1665 const int64 progress_vals[] = {
1768 limitXmin = snapshot->
xmin;
1852 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
1853 errmsg(
"functions in index predicate must be marked IMMUTABLE")));
1870 Datum *opclassOptions,
1872 const List *attList,
1873 const List *exclusionOpNames,
1875 const char *accessMethodName,
1879 bool iswithoutoverlaps,
1881 int ddl_sec_context,
1882 int *ddl_save_nestlevel)
1889 int save_sec_context;
1892 if (exclusionOpNames)
1898 nextExclOp =
list_head(exclusionOpNames);
1909 if (iswithoutoverlaps)
1911 if (exclusionOpNames ==
NIL)
1927 foreach(lc, attList)
1936 if (attribute->
name != NULL)
1949 (
errcode(ERRCODE_UNDEFINED_COLUMN),
1950 errmsg(
"column \"%s\" named in key does not exist",
1954 (
errcode(ERRCODE_UNDEFINED_COLUMN),
1955 errmsg(
"column \"%s\" does not exist",
1960 atttype = attform->atttypid;
1961 attcollation = attform->attcollation;
1971 if (attn >= nkeycols)
1973 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1974 errmsg(
"expressions are not supported in included columns")));
2014 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2015 errmsg(
"functions in index expression must be marked IMMUTABLE")));
2019 typeOids[attn] = atttype;
2025 if (attn >= nkeycols)
2029 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2030 errmsg(
"including column does not support a collation")));
2033 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2034 errmsg(
"including column does not support an operator class")));
2037 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2038 errmsg(
"including column does not support ASC/DESC options")));
2041 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2042 errmsg(
"including column does not support NULLS FIRST/LAST options")));
2045 opclassOptions[attn] = (
Datum) 0;
2046 colOptions[attn] = 0;
2084 (
errcode(ERRCODE_INDETERMINATE_COLLATION),
2085 errmsg(
"could not determine which collation to use for index expression"),
2086 errhint(
"Use the COLLATE clause to set the collation explicitly.")));
2092 (
errcode(ERRCODE_DATATYPE_MISMATCH),
2093 errmsg(
"collations are not supported by type %s",
2097 collationOids[attn] = attcollation;
2159 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
2160 errmsg(
"operator %s is not commutative",
2162 errdetail(
"Only commutative operators can be used in exclusion constraints.")));
2182 elog(
ERROR,
"cache lookup failed for opfamily %u",
2187 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
2188 errmsg(
"operator %s is not a member of operator family \"%s\"",
2191 errdetail(
"The exclusion operator must be related to the index operator class for the constraint.")));
2197 nextExclOp =
lnext(exclusionOpNames, nextExclOp);
2199 else if (iswithoutoverlaps)
2204 if (attn == nkeycols - 1)
2220 colOptions[attn] = 0;
2225 colOptions[attn] |= INDOPTION_DESC;
2230 colOptions[attn] |= INDOPTION_NULLS_FIRST;
2233 colOptions[attn] |= INDOPTION_NULLS_FIRST;
2240 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2241 errmsg(
"access method \"%s\" does not support ASC/DESC options",
2242 accessMethodName)));
2245 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2246 errmsg(
"access method \"%s\" does not support NULLS FIRST/LAST options",
2247 accessMethodName)));
2255 opclassOptions[attn] =
2257 NULL, NULL,
false,
false);
2260 opclassOptions[attn] = (
Datum) 0;
2274 const char *accessMethodName,
Oid accessMethodId)
2289 (
errcode(ERRCODE_UNDEFINED_OBJECT),
2290 errmsg(
"data type %s has no default operator class for access method \"%s\"",
2292 errhint(
"You must specify an operator class for the index or define a default operator class for the data type.")));
2320 (
errcode(ERRCODE_UNDEFINED_OBJECT),
2321 errmsg(
"operator class \"%s\" does not exist for access method \"%s\"",
2322 opcname, accessMethodName)));
2328 (
errcode(ERRCODE_UNDEFINED_OBJECT),
2329 errmsg(
"operator class \"%s\" does not exist for access method \"%s\"",
2337 opClassId = opform->oid;
2338 opInputType = opform->opcintype;
2342 (
errcode(ERRCODE_DATATYPE_MISMATCH),
2343 errmsg(
"operator class \"%s\" does not accept data type %s",
2362 int ncompatible = 0;
2363 int ncompatiblepreferred = 0;
2390 Anum_pg_opclass_opcmethod,
2402 if (!opclass->opcdefault)
2404 if (opclass->opcintype == type_id)
2407 result = opclass->oid;
2409 else if (nexact == 0 &&
2414 ncompatiblepreferred++;
2415 result = opclass->oid;
2417 else if (ncompatiblepreferred == 0)
2420 result = opclass->oid;
2433 errmsg(
"there are multiple default operator classes for data type %s",
2437 ncompatiblepreferred == 1 ||
2438 (ncompatiblepreferred == 0 && ncompatible == 1))
2487 elog(
ERROR,
"cache lookup failed for operator class %u", opclass);
2490 errcode(ERRCODE_UNDEFINED_OBJECT),
2494 errdetail(
"Could not translate strategy number %d for operator class \"%s\" for access method \"%s\".",
2504 rhstype = opcintype;
2514 elog(
ERROR,
"cache lookup failed for operator family %u", opfamily);
2517 errcode(ERRCODE_UNDEFINED_OBJECT),
2521 errdetail(
"There is no suitable operator in operator family \"%s\" for access method \"%s\".",
2558 name1chars = strlen(name1);
2561 name2chars = strlen(name2);
2567 overhead += strlen(
label) + 1;
2577 while (name1chars + name2chars > availchars)
2579 if (name1chars > name2chars)
2585 name1chars =
pg_mbcliplen(name1, name1chars, name1chars);
2587 name2chars =
pg_mbcliplen(name2, name2chars, name2chars);
2590 name =
palloc(name1chars + name2chars + overhead + 1);
2591 memcpy(
name, name1, name1chars);
2596 memcpy(
name + ndx, name2, name2chars);
2636 const char *
label,
Oid namespaceid,
2652 if (!isconstraint ||
2659 snprintf(modlabel,
sizeof(modlabel),
"%s%d",
label, ++pass);
2672 const List *colnames,
const List *exclusionOpNames,
2673 bool primary,
bool isconstraint)
2686 else if (exclusionOpNames !=
NIL)
2694 else if (isconstraint)
2733 foreach(lc, colnames)
2735 const char *
name = (
const char *)
lfirst(lc);
2738 buf[buflen++] =
'_';
2745 buflen += strlen(
buf + buflen);
2765 foreach(lc, indexElems)
2768 const char *origname;
2769 const char *curname;
2776 else if (ielem->
name)
2777 origname = ielem->
name;
2789 foreach(lc2, result)
2791 if (strcmp(curname, (
char *)
lfirst(lc2)) == 0)
2802 memcpy(
buf, origname, nlen);
2803 strcpy(
buf + nlen, nbuf);
2825 bool concurrently =
false;
2827 char *tablespacename = NULL;
2830 foreach(lc,
stmt->params)
2834 if (strcmp(opt->
defname,
"verbose") == 0)
2836 else if (strcmp(opt->
defname,
"concurrently") == 0)
2838 else if (strcmp(opt->
defname,
"tablespace") == 0)
2842 (
errcode(ERRCODE_SYNTAX_ERROR),
2843 errmsg(
"unrecognized REINDEX option \"%s\"",
2850 "REINDEX CONCURRENTLY");
2860 if (tablespacename != NULL)
2901 "REINDEX DATABASE");
2905 elog(
ERROR,
"unrecognized object type: %d",
2950 if (relkind == RELKIND_PARTITIONED_INDEX)
2953 persistence != RELPERSISTENCE_TEMP)
2991 if (relId != oldRelId &&
OidIsValid(oldRelId))
3009 if (relkind != RELKIND_INDEX &&
3010 relkind != RELKIND_PARTITIONED_INDEX)
3012 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3027 if (relId != oldRelId)
3036 state->locked_table_oid = table_oid;
3075 (
errmsg(
"table \"%s\" has no indexes that can be reindexed concurrently",
3089 (
errmsg(
"table \"%s\" has no indexes to reindex",
3117 bool concurrent_warning =
false;
3118 bool tablespace_warning =
false;
3119 const char *objectName =
stmt->name;
3135 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3136 errmsg(
"cannot reindex system catalogs concurrently")));
3159 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3160 errmsg(
"can only reindex the currently open database")));
3174 "ReindexMultipleTables",
3186 Anum_pg_class_relnamespace,
3204 Oid relid = classtuple->oid;
3213 if (classtuple->relkind != RELKIND_RELATION &&
3214 classtuple->relkind != RELKIND_MATVIEW)
3218 if (classtuple->relpersistence == RELPERSISTENCE_TEMP &&
3238 if (classtuple->relisshared &&
3249 if (!concurrent_warning)
3251 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3252 errmsg(
"cannot reindex system catalogs concurrently, skipping all")));
3253 concurrent_warning =
true;
3263 bool skip_rel =
false;
3269 if (RELKIND_HAS_STORAGE(classtuple->relkind) &&
3282 if (!tablespace_warning)
3284 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
3285 errmsg(
"cannot move system relations, skipping all")));
3286 tablespace_warning =
true;
3301 if (relid == RelationRelationId)
3330 if (errinfo->
relkind == RELKIND_PARTITIONED_TABLE)
3331 errcontext(
"while reindexing partitioned table \"%s.%s\"",
3333 else if (errinfo->
relkind == RELKIND_PARTITIONED_INDEX)
3334 errcontext(
"while reindexing partitioned index \"%s.%s\"",
3357 Assert(RELKIND_HAS_PARTITIONS(relkind));
3367 errcallback.
arg = (
void *) &errinfo;
3372 relkind == RELKIND_PARTITIONED_TABLE ?
3373 "REINDEX TABLE" :
"REINDEX INDEX");
3395 foreach(lc, inhoids)
3405 if (!RELKIND_HAS_STORAGE(partkind))
3408 Assert(partkind == RELKIND_INDEX ||
3409 partkind == RELKIND_RELATION);
3450 char relpersistence;
3490 Assert(!RELKIND_HAS_PARTITIONS(relkind));
3493 relpersistence != RELPERSISTENCE_TEMP)
3503 else if (relkind == RELKIND_INDEX)
3527 (
errmsg(
"table \"%s.%s\" was reindexed",
3567 typedef struct ReindexIndexInfo
3584 char *relationName = NULL;
3585 char *relationNamespace = NULL;
3587 const int progress_index[] = {
3593 int64 progress_vals[4];
3602 "ReindexConcurrent",
3626 case RELKIND_RELATION:
3627 case RELKIND_MATVIEW:
3628 case RELKIND_TOASTVALUE:
3640 heapRelationIds =
lappend_oid(heapRelationIds, relationOid);
3646 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3647 errmsg(
"cannot reindex system catalogs concurrently")));
3665 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3666 errmsg(
"cannot move system relation \"%s\"",
3676 if (!indexRelation->
rd_index->indisvalid)
3678 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
3679 errmsg(
"skipping reindex of invalid index \"%s.%s\"",
3682 errhint(
"Use DROP INDEX or REINDEX INDEX.")));
3683 else if (indexRelation->
rd_index->indisexclusion)
3685 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3686 errmsg(
"cannot reindex exclusion constraint index \"%s.%s\" concurrently, skipping",
3691 ReindexIndexInfo *
idx;
3697 idx->indexId = cellOid;
3711 Oid toastOid = heapRelation->
rd_rel->reltoastrelid;
3719 heapRelationIds =
lappend_oid(heapRelationIds, toastOid);
3729 if (!indexRelation->
rd_index->indisvalid)
3731 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
3732 errmsg(
"skipping reindex of invalid index \"%s.%s\"",
3735 errhint(
"Use DROP INDEX or REINDEX INDEX.")));
3738 ReindexIndexInfo *
idx;
3747 idx->indexId = cellOid;
3768 ReindexIndexInfo *
idx;
3776 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3777 errmsg(
"cannot reindex system catalogs concurrently")));
3787 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3788 errmsg(
"cannot reindex invalid index on TOAST table")));
3811 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3812 errmsg(
"cannot move system relation \"%s\"",
3828 idx->indexId = relationOid;
3836 case RELKIND_PARTITIONED_TABLE:
3837 case RELKIND_PARTITIONED_INDEX:
3841 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
3842 errmsg(
"cannot reindex this type of relation concurrently")));
3853 if (indexIds ==
NIL)
3859 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3860 errmsg(
"cannot move non-shared relation to tablespace \"%s\"",
3890 foreach(lc, indexIds)
3892 char *concurrentName;
3894 ReindexIndexInfo *newidx;
3899 int save_sec_context;
3924 #ifdef USE_INJECTION_POINTS
3935 if (indexRel->
rd_rel->relpersistence == RELPERSISTENCE_TEMP)
3936 elog(
ERROR,
"cannot reindex a temporary table concurrently");
3941 progress_vals[1] = 0;
3942 progress_vals[2] =
idx->indexId;
3943 progress_vals[3] =
idx->amId;
3955 heapRel->
rd_rel->relkind != RELKIND_TOASTVALUE)
3958 tablespaceid = indexRel->
rd_rel->reltablespace;
3978 newidx->indexId = newIndexId;
3979 newidx->safe =
idx->safe;
3980 newidx->tableId =
idx->tableId;
3981 newidx->amId =
idx->amId;
3983 newIndexIds =
lappend(newIndexIds, newidx);
3993 relationLocks =
lappend(relationLocks, lockrelid);
3996 relationLocks =
lappend(relationLocks, lockrelid);
4030 foreach(lc, heapRelationIds)
4042 relationLocks =
lappend(relationLocks, lockrelid);
4048 lockTags =
lappend(lockTags, heaplocktag);
4057 foreach(lc, relationLocks)
4088 foreach(lc, newIndexIds)
4090 ReindexIndexInfo *newidx =
lfirst(lc);
4116 progress_vals[2] = newidx->indexId;
4117 progress_vals[3] = newidx->amId;
4147 foreach(lc, newIndexIds)
4149 ReindexIndexInfo *newidx =
lfirst(lc);
4180 progress_vals[2] = newidx->indexId;
4181 progress_vals[3] = newidx->amId;
4190 limitXmin = snapshot->
xmin;
4239 forboth(lc, indexIds, lc2, newIndexIds)
4241 ReindexIndexInfo *oldidx =
lfirst(lc);
4242 ReindexIndexInfo *newidx =
lfirst(lc2);
4304 foreach(lc, indexIds)
4306 ReindexIndexInfo *oldidx =
lfirst(lc);
4343 foreach(lc, indexIds)
4348 object.
classId = RelationRelationId;
4349 object.objectId =
idx->indexId;
4350 object.objectSubId = 0;
4369 foreach(lc, relationLocks)
4382 if (relkind == RELKIND_INDEX)
4384 (
errmsg(
"index \"%s.%s\" was reindexed",
4385 relationNamespace, relationName),
4390 foreach(lc, newIndexIds)
4393 Oid indOid =
idx->indexId;
4396 (
errmsg(
"index \"%s.%s\" was reindexed",
4403 (
errmsg(
"table \"%s.%s\" was reindexed",
4404 relationNamespace, relationName),
4434 Assert(partitionIdx->
rd_rel->relkind == RELKIND_INDEX ||
4435 partitionIdx->
rd_rel->relkind == RELKIND_PARTITIONED_INDEX);
4442 Anum_pg_inherits_inhrelid,
4446 Anum_pg_inherits_inhseqno,
4488 if (inhForm->inhparent != parentOid)
4491 elog(
ERROR,
"bogus pg_inherit row: inhrelid %u inhparent %u",
4492 inhForm->inhrelid, inhForm->inhparent);
4564 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)
bytea *(* amoptions_function)(Datum reloptions, bool validate)
Datum array_eq(PG_FUNCTION_ARGS)
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
bool bms_is_member(int x, const Bitmapset *a)
#define InvalidSubTransactionId
#define Assert(condition)
#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 * get_database_name(Oid dbid)
bool defGetBoolean(DefElem *def)
char * defGetString(DefElem *def)
void performMultipleDeletions(const ObjectAddresses *objects, DropBehavior behavior, int flags)
ObjectAddresses * new_object_addresses(void)
void add_exact_object_address(const ObjectAddress *object, ObjectAddresses *addrs)
@ 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)
#define DirectFunctionCall2(func, arg1, arg2)
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)
StrategyNumber GistTranslateStratnum(Oid opclass, StrategyNumber strat)
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)
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)
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)
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)
IndexInfo * BuildIndexInfo(Relation index)
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)
char * makeObjectName(const char *name1, const char *name2, const char *label)
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)
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)
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 GetOperatorFromWellKnownStrategy(Oid opclass, Oid rhstype, Oid *opid, StrategyNumber *strat)
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)
static char * ChooseIndexName(const char *tabname, Oid namespaceId, const List *colnames, const List *exclusionOpNames, bool primary, bool isconstraint)
char * ChooseRelationName(const char *name1, const char *name2, const char *label, Oid namespaceid, bool isconstraint)
void CatalogTupleUpdate(Relation heapRel, ItemPointer otid, HeapTuple tup)
void CatalogTupleDelete(Relation heapRel, ItemPointer tid)
#define INJECTION_POINT(name)
void CacheInvalidateRelcacheByRelid(Oid relid)
List * lappend(List *list, void *datum)
List * lappend_oid(List *list, Oid datum)
void list_free(List *list)
List * lcons_oid(Oid datum, List *list)
List * list_concat_copy(const List *list1, const List *list2)
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 ShareUpdateExclusiveLock
char get_rel_persistence(Oid relid)
char * get_opname(Oid opno)
bool get_index_isvalid(Oid index_oid)
Oid get_opclass_input_type(Oid opclass)
Oid get_opclass_family(Oid opclass)
char * get_namespace_name(Oid nspid)
bool get_opclass_opfamily_and_input_type(Oid opclass, Oid *opfamily, Oid *opcintype)
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)
char * get_rel_name(Oid relid)
Oid get_opfamily_member(Oid opfamily, Oid lefttype, Oid righttype, int16 strategy)
bool type_is_collatable(Oid typid)
Oid getBaseType(Oid typid)
Oid get_relname_relid(const char *relname, Oid relnamespace)
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)
List * make_ands_implicit(Expr *clause)
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)
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)
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)
char * NameListToString(const List *names)
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)
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)
@ 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
FormData_pg_opfamily * Form_pg_opfamily
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 Int32GetDatum(int32 X)
#define PROC_IS_AUTOVACUUM
PGPROC * ProcNumberGetProc(ProcNumber procNumber)
VirtualTransactionId * GetCurrentVirtualXIDs(TransactionId limitXmin, bool excludeXmin0, bool allDbs, int excludeVacuum, int *nvxids)
#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
MemoryContextSwitchTo(old_ctx)
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)
void RelationGetExclusionInfo(Relation indexRelation, Oid **operators, Oid **procs, uint16 **strategies)
List * RelationGetIndexExpressions(Relation relation)
bytea * index_reloptions(amoptions_function amoptions, Datum reloptions, bool validate)
Datum transformRelOptions(Datum oldOptions, List *defList, const char *namspace, const char *const validnsps[], bool acceptOidsOff, bool isReset)
#define InvalidRelFileNumber
#define RelFileNumberIsValid(relnumber)
Node * map_variable_attnos(Node *node, int target_varno, int sublevels_up, const AttrMap *attno_map, Oid to_rowtype, bool *found_whole_row)
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)
void relation_close(Relation relation, LOCKMODE lockmode)
Relation relation_open(Oid relationId, LOCKMODE lockmode)
#define RTOverlapStrategyNumber
#define RTEqualStrategyNumber
#define HTEqualStrategyNumber
#define BTEqualStrategyNumber
#define RTContainedByStrategyNumber
#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]
SubTransactionId oldFirstRelfilelocatorSubid
SubTransactionId oldCreateSubid
Oid values[FLEXIBLE_ARRAY_MEMBER]
#define FirstLowInvalidHeapAttributeNumber
void ReleaseSysCache(HeapTuple tuple)
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 SearchSysCacheCopy1(cacheId, key1)
#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, struct 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
#define TupleDescAttr(tupdesc, 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)