Track sort direction in SortGroupClause
authorPeter Eisentraut <peter@eisentraut.org>
Mon, 14 Oct 2024 13:36:02 +0000 (15:36 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Mon, 14 Oct 2024 13:36:02 +0000 (15:36 +0200)
commit0d2aa4d4937bb0500823edfc7d620f4e5fa45b9c
treeb5165a7924bd11544d649daac2052a649b7e6b3f
parente7d0cf42b1acb185edc947a8732843966ea3c160
Track sort direction in SortGroupClause

Functions make_pathkey_from_sortop() and transformWindowDefinitions(),
which receive a SortGroupClause, were determining the sort order
(ascending vs. descending) by comparing that structure's operator
strategy to BTLessStrategyNumber, but could just as easily have gotten
it from the SortGroupClause object, if it had such a field, so add
one.  This reduces the number of places that hardcode the assumption
that the strategy refers specifically to a btree strategy, rather than
some other index AM's operators.

Author: Mark Dilger <mark.dilger@enterprisedb.com>
Discussion: https://www.postgresql.org/message-id/flat/E72EAA49-354D-4C2E-8EB9-255197F55330@enterprisedb.com
src/backend/optimizer/path/pathkeys.c
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/planagg.c
src/backend/parser/analyze.c
src/backend/parser/parse_clause.c
src/backend/utils/cache/lsyscache.c
src/include/catalog/catversion.h
src/include/nodes/parsenodes.h