mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Revert CREATE INDEX ... INCLUDING ...
It's not ready yet, revert two commits690c543550
- unstable test output386e3d7609
- patch itself
This commit is contained in:
@ -173,7 +173,7 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent,
|
||||
Form_pg_index index;
|
||||
IndexAmRoutine *amroutine;
|
||||
IndexOptInfo *info;
|
||||
int ncolumns, nkeycolumns;
|
||||
int ncolumns;
|
||||
int i;
|
||||
|
||||
/*
|
||||
@ -216,25 +216,19 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent,
|
||||
RelationGetForm(indexRelation)->reltablespace;
|
||||
info->rel = rel;
|
||||
info->ncolumns = ncolumns = index->indnatts;
|
||||
info->nkeycolumns = nkeycolumns = index->indnkeyatts;
|
||||
|
||||
info->indexkeys = (int *) palloc(sizeof(int) * ncolumns);
|
||||
info->indexcollations = (Oid *) palloc(sizeof(Oid) * ncolumns);
|
||||
info->opfamily = (Oid *) palloc(sizeof(Oid) * nkeycolumns);
|
||||
info->opcintype = (Oid *) palloc(sizeof(Oid) * nkeycolumns);
|
||||
info->opfamily = (Oid *) palloc(sizeof(Oid) * ncolumns);
|
||||
info->opcintype = (Oid *) palloc(sizeof(Oid) * ncolumns);
|
||||
info->canreturn = (bool *) palloc(sizeof(bool) * ncolumns);
|
||||
|
||||
for (i = 0; i < ncolumns; i++)
|
||||
{
|
||||
info->indexkeys[i] = index->indkey.values[i];
|
||||
info->indexcollations[i] = indexRelation->rd_indcollation[i];
|
||||
info->canreturn[i] = index_can_return(indexRelation, i + 1);
|
||||
}
|
||||
|
||||
for (i = 0; i < nkeycolumns; i++)
|
||||
{
|
||||
info->opfamily[i] = indexRelation->rd_opfamily[i];
|
||||
info->opcintype[i] = indexRelation->rd_opcintype[i];
|
||||
info->canreturn[i] = index_can_return(indexRelation, i + 1);
|
||||
}
|
||||
|
||||
info->relam = indexRelation->rd_rel->relam;
|
||||
@ -262,10 +256,10 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent,
|
||||
Assert(amroutine->amcanorder);
|
||||
|
||||
info->sortopfamily = info->opfamily;
|
||||
info->reverse_sort = (bool *) palloc(sizeof(bool) * nkeycolumns);
|
||||
info->nulls_first = (bool *) palloc(sizeof(bool) * nkeycolumns);
|
||||
info->reverse_sort = (bool *) palloc(sizeof(bool) * ncolumns);
|
||||
info->nulls_first = (bool *) palloc(sizeof(bool) * ncolumns);
|
||||
|
||||
for (i = 0; i < nkeycolumns; i++)
|
||||
for (i = 0; i < ncolumns; i++)
|
||||
{
|
||||
int16 opt = indexRelation->rd_indoption[i];
|
||||
|
||||
@ -289,11 +283,11 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent,
|
||||
* of current or foreseeable amcanorder index types, it's not
|
||||
* worth expending more effort on now.
|
||||
*/
|
||||
info->sortopfamily = (Oid *) palloc(sizeof(Oid) * nkeycolumns);
|
||||
info->reverse_sort = (bool *) palloc(sizeof(bool) * nkeycolumns);
|
||||
info->nulls_first = (bool *) palloc(sizeof(bool) * nkeycolumns);
|
||||
info->sortopfamily = (Oid *) palloc(sizeof(Oid) * ncolumns);
|
||||
info->reverse_sort = (bool *) palloc(sizeof(bool) * ncolumns);
|
||||
info->nulls_first = (bool *) palloc(sizeof(bool) * ncolumns);
|
||||
|
||||
for (i = 0; i < nkeycolumns; i++)
|
||||
for (i = 0; i < ncolumns; i++)
|
||||
{
|
||||
int16 opt = indexRelation->rd_indoption[i];
|
||||
Oid ltopr;
|
||||
@ -687,7 +681,7 @@ infer_arbiter_indexes(PlannerInfo *root)
|
||||
goto next;
|
||||
|
||||
/* Build BMS representation of cataloged index attributes */
|
||||
for (natt = 0; natt < idxForm->indnkeyatts; natt++)
|
||||
for (natt = 0; natt < idxForm->indnatts; natt++)
|
||||
{
|
||||
int attno = idxRel->rd_index->indkey.values[natt];
|
||||
|
||||
@ -1626,7 +1620,7 @@ has_unique_index(RelOptInfo *rel, AttrNumber attno)
|
||||
* just the specified attr is unique.
|
||||
*/
|
||||
if (index->unique &&
|
||||
index->nkeycolumns == 1 &&
|
||||
index->ncolumns == 1 &&
|
||||
index->indexkeys[0] == attno &&
|
||||
(index->indpred == NIL || index->predOK))
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user