1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-24 09:27:52 +03:00

Simplify pg_am representation of ordering-capable access methods:

provide just a boolean 'amcanorder', instead of fields that specify the
sort operator strategy numbers.  We have decided to require ordering-capable
AMs to use btree-compatible strategy numbers, so the old fields are
overkill (and indeed misleading about what's allowed).
This commit is contained in:
Tom Lane
2007-01-20 23:13:01 +00:00
parent c82cc604f5
commit fcf4b146c6
8 changed files with 58 additions and 80 deletions

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/indexcmds.c,v 1.152 2007/01/09 02:14:11 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/indexcmds.c,v 1.153 2007/01/20 23:13:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -295,8 +295,7 @@ DefineIndex(RangeVar *heapRelation,
errmsg("access method \"%s\" does not support multicolumn indexes",
accessMethodName)));
amcanorder = (accessMethodForm->amorderstrategy > 0);
amcanorder = accessMethodForm->amcanorder;
amoptions = accessMethodForm->amoptions;
ReleaseSysCache(tuple);

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.131 2007/01/09 02:14:13 tgl Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.132 2007/01/20 23:13:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -190,8 +190,10 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent,
/*
* Fetch the ordering operators associated with the index, if any.
* We expect that all ordering-capable indexes use btree's
* strategy numbers for the ordering operators.
*/
if (indexRelation->rd_am->amorderstrategy > 0)
if (indexRelation->rd_am->amcanorder)
{
int nstrat = indexRelation->rd_am->amstrategies;
@@ -203,17 +205,17 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent,
if (opt & INDOPTION_DESC)
{
fwdstrat = indexRelation->rd_am->amdescorder;
revstrat = indexRelation->rd_am->amorderstrategy;
fwdstrat = BTGreaterStrategyNumber;
revstrat = BTLessStrategyNumber;
}
else
{
fwdstrat = indexRelation->rd_am->amorderstrategy;
revstrat = indexRelation->rd_am->amdescorder;
fwdstrat = BTLessStrategyNumber;
revstrat = BTGreaterStrategyNumber;
}
/*
* Index AM must have a fixed set of strategies for it
* to make sense to specify amorderstrategy, so we
* to make sense to specify amcanorder, so we
* need not allow the case amstrategies == 0.
*/
if (fwdstrat > 0)

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.244 2007/01/20 01:08:42 neilc Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.245 2007/01/20 23:13:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -767,7 +767,7 @@ pg_get_indexdef_worker(Oid indexrelid, int colno, int prettyFlags)
&buf);
/* Add options if relevant */
if (amrec->amorderstrategy > 0)
if (amrec->amcanorder)
{
/* if it supports sort ordering, report DESC and NULLS opts */
if (opt & INDOPTION_DESC)