1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-29 10:41:53 +03:00

Relax ordering-related hardcoded btree requirements in planning

There were several places in ordering-related planning where a
requirement for btree was hardcoded but an amcanorder index could
suffice.  This fixes that.  We just need to do the necessary mapping
between strategy numbers and compare types and adjust some related
APIs so that this works independent of btree strategy numbers.  For
instance, non-btree amcanorder indexes can now be used to support
sorting and merge joins.  Also, predtest.c works independent of btree
strategy numbers now.

To avoid performance regressions, some details on btree and other
built-in index types are still hardcoded as shortcuts, but other index
types now have access to the same features by providing the required
flags and callbacks.

Author: Mark Dilger <mark.dilger@enterprisedb.com>
Co-authored-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://www.postgresql.org/message-id/flat/E72EAA49-354D-4C2E-8EB9-255197F55330@enterprisedb.com
This commit is contained in:
Peter Eisentraut
2025-04-06 14:43:51 +02:00
parent 3a1a7c5a70
commit a8025f5448
16 changed files with 298 additions and 226 deletions

View File

@ -2915,7 +2915,7 @@ transformWindowDefinitions(ParseState *pstate,
{
SortGroupClause *sortcl;
Node *sortkey;
int16 rangestrategy;
CompareType rangecmptype;
if (list_length(wc->orderClause) != 1)
ereport(ERROR,
@ -2928,7 +2928,7 @@ transformWindowDefinitions(ParseState *pstate,
if (!get_ordering_op_properties(sortcl->sortop,
&rangeopfamily,
&rangeopcintype,
&rangestrategy))
&rangecmptype))
elog(ERROR, "operator %u is not a valid ordering operator",
sortcl->sortop);
/* Record properties of sort ordering */