diff options
Diffstat (limited to 'src/backend/optimizer')
-rw-r--r-- | src/backend/optimizer/util/plancat.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c index de14ddd2dc0..70a77bd3bd8 100644 --- a/src/backend/optimizer/util/plancat.c +++ b/src/backend/optimizer/util/plancat.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.127 2006/10/04 00:29:55 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.128 2006/12/18 18:56:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -190,10 +190,17 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent, * Fetch the ordering operators associated with the index, if any. */ amorderstrategy = indexRelation->rd_am->amorderstrategy; - if (amorderstrategy != 0) + if (amorderstrategy > 0) { int oprindex = amorderstrategy - 1; + /* + * Index AM must have a fixed set of strategies for it to + * make sense to specify amorderstrategy, so we need not + * allow the case amstrategies == 0. + */ + Assert(oprindex < indexRelation->rd_am->amstrategies); + for (i = 0; i < ncolumns; i++) { info->ordering[i] = indexRelation->rd_operator[oprindex]; |