diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-11-20 15:07:16 -0500 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-11-20 15:07:16 -0500 |
| commit | 89a368418c56125f79f46a81229e824d519f9718 (patch) | |
| tree | 20fcf3b7c087f1abe9c68b67f939547f763c5797 /src/backend/optimizer/util | |
| parent | 99bc012d5198bdfd2aa67336f645dbf887bb0ec9 (diff) | |
| download | postgresql-89a368418c56125f79f46a81229e824d519f9718.tar.gz | |
Further cleanup of indxpath logic related to IndexOptInfo.opfamily array.
We no longer need the terminating zero entry in opfamily[], so get rid of
it. Also replace assorted ad-hoc looping logic with simple for and foreach
constructs. This code is now noticeably more readable than it was an hour
ago; credit to Robert for seeing that it could be simplified.
Diffstat (limited to 'src/backend/optimizer/util')
| -rw-r--r-- | src/backend/optimizer/util/plancat.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c index aafaf843fc..73132ddf5c 100644 --- a/src/backend/optimizer/util/plancat.c +++ b/src/backend/optimizer/util/plancat.c @@ -192,13 +192,13 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent, /* * Allocate per-column info arrays. To save a few palloc cycles - * we allocate all the Oid-type arrays in one request. Note that - * the opfamily array needs an extra, terminating zero at the end. - * We pre-zero the ordering info in case the index is unordered. + * we allocate all the Oid-type arrays in one request. We must + * pre-zero the sortop and nulls_first arrays in case the index is + * unordered. */ info->indexkeys = (int *) palloc(sizeof(int) * ncolumns); - info->opfamily = (Oid *) palloc0(sizeof(Oid) * (4 * ncolumns + 1)); - info->opcintype = info->opfamily + (ncolumns + 1); + info->opfamily = (Oid *) palloc0(sizeof(Oid) * (4 * ncolumns)); + info->opcintype = info->opfamily + ncolumns; info->fwdsortop = info->opcintype + ncolumns; info->revsortop = info->fwdsortop + ncolumns; info->nulls_first = (bool *) palloc0(sizeof(bool) * ncolumns); |
