diff options
| author | Tom Lane | 1999-12-13 01:27:21 +0000 |
|---|---|---|
| committer | Tom Lane | 1999-12-13 01:27:21 +0000 |
| commit | a8ae19ec3d13452de931736126d0786a148ee643 (patch) | |
| tree | 3dbdbba249c27b5362865f9ff1c7b2675c136574 /src/include | |
| parent | efb36d2be8272d03167fe4205b640129ffe583fb (diff) | |
aggregate(DISTINCT ...) works, per SQL spec.
Note this forces initdb because of change of Aggref node in stored rules.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/catalog/catversion.h | 4 | ||||
| -rw-r--r-- | src/include/nodes/primnodes.h | 8 | ||||
| -rw-r--r-- | src/include/optimizer/clauses.h | 3 | ||||
| -rw-r--r-- | src/include/utils/tuplesort.h | 19 |
4 files changed, 25 insertions, 9 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 728c62b1200..62244f88a47 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -36,7 +36,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: catversion.h,v 1.4 1999/11/24 16:52:48 momjian Exp $ + * $Id: catversion.h,v 1.5 1999/12/13 01:27:07 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -51,6 +51,6 @@ * catalog changes on the same day...) */ -#define CATALOG_VERSION_NO 199911241 +#define CATALOG_VERSION_NO 199912121 #endif diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h index 2d585bdcc5a..d3fb8f732a5 100644 --- a/src/include/nodes/primnodes.h +++ b/src/include/nodes/primnodes.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: primnodes.h,v 1.37 1999/11/15 02:00:15 tgl Exp $ + * $Id: primnodes.h,v 1.38 1999/12/13 01:27:10 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -297,10 +297,12 @@ typedef struct Iter /* ---------------- * Aggref * aggname - name of the aggregate - * basetype - base type Oid of the aggregate + * basetype - base type Oid of the aggregate (ie, input type) * aggtype - type Oid of final result of the aggregate * target - attribute or expression we are aggregating on * usenulls - TRUE to accept null values as inputs + * aggstar - TRUE if argument was really '*' + * aggdistinct - TRUE if arguments were labeled DISTINCT * aggno - workspace for nodeAgg.c executor * ---------------- */ @@ -312,6 +314,8 @@ typedef struct Aggref Oid aggtype; Node *target; bool usenulls; + bool aggstar; + bool aggdistinct; int aggno; } Aggref; diff --git a/src/include/optimizer/clauses.h b/src/include/optimizer/clauses.h index 829bf434e78..4cd2e486aa4 100644 --- a/src/include/optimizer/clauses.h +++ b/src/include/optimizer/clauses.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: clauses.h,v 1.31 1999/12/09 05:58:55 tgl Exp $ + * $Id: clauses.h,v 1.32 1999/12/13 01:27:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -38,6 +38,7 @@ extern Expr *make_ands_explicit(List *andclauses); extern List *make_ands_implicit(Expr *clause); extern List *pull_constant_clauses(List *quals, List **constantQual); +extern bool contain_agg_clause(Node *clause); extern List *pull_agg_clause(Node *clause); extern void check_subplans_for_ungrouped_vars(Node *clause, Query *query, diff --git a/src/include/utils/tuplesort.h b/src/include/utils/tuplesort.h index 7c5a3209897..4f775f74a55 100644 --- a/src/include/utils/tuplesort.h +++ b/src/include/utils/tuplesort.h @@ -3,8 +3,8 @@ * tuplesort.h * Generalized tuple sorting routines. * - * This module handles sorting of either heap tuples or index tuples - * (and could fairly easily support other kinds of sortable objects, + * This module handles sorting of heap tuples, index tuples, or single + * Datums (and could easily support other kinds of sortable objects, * if necessary). It works efficiently for both small and large amounts * of data. Small amounts are sorted in-memory using qsort(). Large * amounts are sorted using temporary files and a standard external sort @@ -12,7 +12,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: tuplesort.h,v 1.1 1999/10/17 22:15:09 tgl Exp $ + * $Id: tuplesort.h,v 1.2 1999/12/13 01:27:17 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -34,6 +34,7 @@ typedef struct Tuplesortstate Tuplesortstate; * code: one for sorting HeapTuples and one for sorting IndexTuples. * They differ primarily in the way that the sort key information is * supplied. + * Yet a third slightly different interface supports sorting bare Datums. */ extern Tuplesortstate *tuplesort_begin_heap(TupleDesc tupDesc, @@ -42,9 +43,15 @@ extern Tuplesortstate *tuplesort_begin_heap(TupleDesc tupDesc, extern Tuplesortstate *tuplesort_begin_index(Relation indexRel, bool enforceUnique, bool randomAccess); +extern Tuplesortstate *tuplesort_begin_datum(Oid datumType, + Oid sortOperator, + bool randomAccess); extern void tuplesort_puttuple(Tuplesortstate *state, void *tuple); +extern void tuplesort_putdatum(Tuplesortstate *state, Datum val, + bool isNull); + extern void tuplesort_performsort(Tuplesortstate *state); extern void *tuplesort_gettuple(Tuplesortstate *state, bool forward, @@ -54,11 +61,15 @@ extern void *tuplesort_gettuple(Tuplesortstate *state, bool forward, #define tuplesort_getindextuple(state, forward, should_free) \ ((IndexTuple) tuplesort_gettuple(state, forward, should_free)) +extern bool tuplesort_getdatum(Tuplesortstate *state, bool forward, + Datum *val, bool *isNull); + extern void tuplesort_end(Tuplesortstate *state); /* * These routines may only be called if randomAccess was specified 'true'. - * Backwards scan in gettuple is likewise only allowed if randomAccess. + * Likewise, backwards scan in gettuple/getdatum is only allowed if + * randomAccess was specified. */ extern void tuplesort_rescan(Tuplesortstate *state); |
