From 2d1d96b1cea8f67a095e8f28372af4081605f681 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 7 Aug 2008 01:11:52 +0000 Subject: Teach the system how to use hashing for UNION. (INTERSECT/EXCEPT will follow, but seem like a separate patch since most of the remaining work is on the executor side.) I took the opportunity to push selection of the grouping operators for set operations into the parser where it belongs. Otherwise this is just a small exercise in making prepunion.c consider both alternatives. As with the recent DISTINCT patch, this means we can UNION on datatypes that can hash but not sort, and it means that UNION without ORDER BY is no longer certain to produce sorted output. --- src/include/optimizer/tlist.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/include/optimizer/tlist.h') diff --git a/src/include/optimizer/tlist.h b/src/include/optimizer/tlist.h index 8a8966213b..9899b14c82 100644 --- a/src/include/optimizer/tlist.h +++ b/src/include/optimizer/tlist.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/optimizer/tlist.h,v 1.50 2008/08/02 21:32:01 tgl Exp $ + * $PostgreSQL: pgsql/src/include/optimizer/tlist.h,v 1.51 2008/08/07 01:11:52 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -32,6 +32,11 @@ extern Node *get_sortgroupclause_expr(SortGroupClause *sgClause, extern List *get_sortgrouplist_exprs(List *sgClauses, List *targetList); +extern Oid *extract_grouping_ops(List *groupClause); +extern AttrNumber *extract_grouping_cols(List *groupClause, List *tlist); +extern bool grouping_is_sortable(List *groupClause); +extern bool grouping_is_hashable(List *groupClause); + extern bool tlist_same_datatypes(List *tlist, List *colTypes, bool junkOK); #endif /* TLIST_H */ -- cgit v1.2.1