postgresql/src/backend/utils/cache
Tom Lane 9511304752 Rearrange the querytree representation of ORDER BY/GROUP BY/DISTINCT items
as per my recent proposal:

1. Fold SortClause and GroupClause into a single node type SortGroupClause.
We were already relying on them to be struct-equivalent, so using two node
tags wasn't accomplishing much except to get in the way of comparing items
with equal().

2. Add an "eqop" field to SortGroupClause to carry the associated equality
operator.  This is cheap for the parser to get at the same time it's looking
up the sort operator, and storing it eliminates the need for repeated
not-so-cheap lookups during planning.  In future this will also let us
represent GROUP/DISTINCT operations on datatypes that have hash opclasses
but no btree opclasses (ie, they have equality but no natural sort order).
The previous representation simply didn't work for that, since its only
indicator of comparison semantics was a sort operator.

3. Add a hasDistinctOn boolean to struct Query to explicitly record whether
the distinctClause came from DISTINCT or DISTINCT ON.  This allows removing
some complicated and not 100% bulletproof code that attempted to figure
that out from the distinctClause alone.

This patch doesn't in itself create any new capability, but it's necessary
infrastructure for future attempts to use hash-based grouping for DISTINCT
and UNION/INTERSECT/EXCEPT.
2008-08-02 21:32:01 +00:00
..
catcache.c Improve our #include situation by moving pointer types away from the 2008-06-19 00:46:06 +00:00
inval.c Rewrite the sinval messaging mechanism to reduce contention and avoid 2008-06-19 21:32:56 +00:00
lsyscache.c Rearrange the querytree representation of ORDER BY/GROUP BY/DISTINCT items 2008-08-02 21:32:01 +00:00
Makefile Refactor backend makefiles to remove lots of duplicate code 2008-02-19 10:30:09 +00:00
plancache.c Adjust things so that the query_string of a cached plan and the sourceText of 2008-07-18 20:26:06 +00:00
relcache.c Restructure some header files a bit, in particular heapam.h, by removing some 2008-05-12 00:00:54 +00:00
syscache.c Improve our #include situation by moving pointer types away from the 2008-06-19 00:46:06 +00:00
ts_cache.c Create new routines systable_beginscan_ordered, systable_getnext_ordered, 2008-04-12 23:14:21 +00:00
typcache.c Improve our #include situation by moving pointer types away from the 2008-06-19 00:46:06 +00:00