summaryrefslogtreecommitdiff
path: root/src/include/optimizer
diff options
context:
space:
mode:
authorTom Lane2000-01-27 18:11:50 +0000
committerTom Lane2000-01-27 18:11:50 +0000
commitdd979f66be20fc54aad06da743f788fbc505bbe1 (patch)
tree4d6b578e0afc7dc0198296940cd77c79c5eff66c /src/include/optimizer
parent3f0074e403ac3a145c5e43db3348f45fe084703d (diff)
Redesign DISTINCT ON as discussed in pgsql-sql 1/25/00: syntax is now
SELECT DISTINCT ON (expr [, expr ...]) targetlist ... and there is a check to make sure that the user didn't specify an ORDER BY that's incompatible with the DISTINCT operation. Reimplement nodeUnique and nodeGroup to use the proper datatype-specific equality function for each column being compared --- they used to do bitwise comparisons or convert the data to text strings and strcmp(). (To add insult to injury, they'd look up the conversion functions once for each tuple...) Parse/plan representation of DISTINCT is now a list of SortClause nodes. initdb forced by querytree change...
Diffstat (limited to 'src/include/optimizer')
-rw-r--r--src/include/optimizer/planmain.h4
-rw-r--r--src/include/optimizer/tlist.h5
2 files changed, 6 insertions, 3 deletions
diff --git a/src/include/optimizer/planmain.h b/src/include/optimizer/planmain.h
index 826c5dbe3ce..340f54485cb 100644
--- a/src/include/optimizer/planmain.h
+++ b/src/include/optimizer/planmain.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: planmain.h,v 1.36 2000/01/26 05:58:20 momjian Exp $
+ * $Id: planmain.h,v 1.37 2000/01/27 18:11:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -33,7 +33,7 @@ extern Agg *make_agg(List *tlist, Plan *lefttree);
extern Group *make_group(List *tlist, bool tuplePerGroup, int ngrp,
AttrNumber *grpColIdx, Plan *lefttree);
extern Noname *make_noname(List *tlist, List *pathkeys, Plan *subplan);
-extern Unique *make_unique(List *tlist, Plan *lefttree, char *uniqueAttr);
+extern Unique *make_unique(List *tlist, Plan *lefttree, List *distinctList);
extern Result *make_result(List *tlist, Node *resconstantqual, Plan *subplan);
/*
diff --git a/src/include/optimizer/tlist.h b/src/include/optimizer/tlist.h
index 986c47ee796..dba93c0d173 100644
--- a/src/include/optimizer/tlist.h
+++ b/src/include/optimizer/tlist.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: tlist.h,v 1.23 2000/01/26 05:58:21 momjian Exp $
+ * $Id: tlist.h,v 1.24 2000/01/27 18:11:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,6 +28,9 @@ extern List *flatten_tlist(List *tlist);
extern List *add_to_flat_tlist(List *tlist, List *vars);
extern Var *get_expr(TargetEntry *tle);
+
+extern TargetEntry *get_sortgroupclause_tle(SortClause *sortClause,
+ List *targetList);
extern Node *get_sortgroupclause_expr(SortClause *sortClause,
List *targetList);