aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/indexcmds.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2020-11-15 16:10:48 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2020-11-15 16:10:48 -0500
commit7c89246d0bb233be7d6670f0a8f024e99423e8cc (patch)
tree00ddaaebb2baba37d1de8d053425a005a422bd4d /src/backend/commands/indexcmds.c
parent0e0e71abdcaeb8a3887094de078b77cb35bd03ba (diff)
downloadpostgresql-7c89246d0bb233be7d6670f0a8f024e99423e8cc.tar.gz
postgresql-7c89246d0bb233be7d6670f0a8f024e99423e8cc.zip
Fix fuzzy thinking about amcanmulticol versus amcaninclude.
These flags should be independent: in particular an index AM should be able to say that it supports include columns without necessarily supporting multiple key columns. The included-columns patch got this wrong, possibly aided by the fact that it didn't bother to update the documentation. While here, clarify some text about amcanreturn, which was a little vague about what should happen when amcanreturn reports that only some of the index columns are returnable. Noted while reviewing the SP-GiST included-columns patch, which quite incorrectly (and unsafely) changed SP-GiST to claim amcanmulticol = true as a workaround for this bug. Backpatch to v11 where included columns were introduced.
Diffstat (limited to 'src/backend/commands/indexcmds.c')
-rw-r--r--src/backend/commands/indexcmds.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index 4d9a19a16a7..69329361fa7 100644
--- a/src/backend/commands/indexcmds.c
+++ b/src/backend/commands/indexcmds.c
@@ -584,7 +584,7 @@ DefineIndex(Oid relationId,
stmt->indexIncludingParams);
numberOfAttributes = list_length(allIndexParams);
- if (numberOfAttributes <= 0)
+ if (numberOfKeyAttributes <= 0)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("must specify at least one column")));
@@ -807,7 +807,7 @@ DefineIndex(Oid relationId,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("access method \"%s\" does not support included columns",
accessMethodName)));
- if (numberOfAttributes > 1 && !amRoutine->amcanmulticol)
+ if (numberOfKeyAttributes > 1 && !amRoutine->amcanmulticol)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("access method \"%s\" does not support multicolumn indexes",