diff options
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/catalog/index.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index be363ce4dc3..bc20d7c750b 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -369,6 +369,14 @@ ConstructTupleDescriptor(Relation heapRelation, memcpy(to, from, ATTRIBUTE_FIXED_PART_SIZE); /* + * Set the attribute name as specified by caller. + */ + if (colnames_item == NULL) /* shouldn't happen */ + elog(ERROR, "too few entries in colnames list"); + namestrcpy(&to->attname, (const char *) lfirst(colnames_item)); + colnames_item = lnext(colnames_item); + + /* * Fix the stuff that should not be the same as the underlying * attr */ @@ -392,6 +400,14 @@ ConstructTupleDescriptor(Relation heapRelation, MemSet(to, 0, ATTRIBUTE_FIXED_PART_SIZE); + /* + * Set the attribute name as specified by caller. + */ + if (colnames_item == NULL) /* shouldn't happen */ + elog(ERROR, "too few entries in colnames list"); + namestrcpy(&to->attname, (const char *) lfirst(colnames_item)); + colnames_item = lnext(colnames_item); + if (indexpr_item == NULL) /* shouldn't happen */ elog(ERROR, "too few entries in indexprs list"); indexkey = (Node *) lfirst(indexpr_item); @@ -446,14 +462,6 @@ ConstructTupleDescriptor(Relation heapRelation, to->attrelid = InvalidOid; /* - * Set the attribute name as specified by caller. - */ - if (colnames_item == NULL) /* shouldn't happen */ - elog(ERROR, "too few entries in colnames list"); - namestrcpy(&to->attname, (const char *) lfirst(colnames_item)); - colnames_item = lnext(colnames_item); - - /* * Check the opclass and index AM to see if either provides a keytype * (overriding the attribute type). Opclass (if exists) takes * precedence. |