From bec98a31c55a4f799b398d01541e68d7c086bb81 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 17 Jul 2000 03:05:41 +0000 Subject: Revise aggregate functions per earlier discussions in pghackers. There's now only one transition value and transition function. NULL handling in aggregates is a lot cleaner. Also, use Numeric accumulators instead of integer accumulators for sum/avg on integer datatypes --- this avoids overflow at the cost of being a little slower. Implement VARIANCE() and STDDEV() aggregates in the standard backend. Also, enable new LIKE selectivity estimators by default. Unrelated change, but as long as I had to force initdb anyway... --- src/include/c.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/include/c.h') diff --git a/src/include/c.h b/src/include/c.h index 603c5bbfe85..60abde17368 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: c.h,v 1.78 2000/07/12 22:59:12 petere Exp $ + * $Id: c.h,v 1.79 2000/07/17 03:05:20 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -587,6 +587,25 @@ extern Datum Float8GetDatum(float8 X); #define Float64GetDatum(X) PointerGetDatum(X) +/* + * Int64GetDatumFast + * Float4GetDatumFast + * Float8GetDatumFast + * + * These macros are intended to allow writing code that does not depend on + * whether int64, float4, float8 are pass-by-reference types, while not + * sacrificing performance when they are. The argument must be a variable + * that will exist and have the same value for as long as the Datum is needed. + * In the pass-by-ref case, the address of the variable is taken to use as + * the Datum. In the pass-by-val case, these will be the same as the non-Fast + * macros. + */ + +#define Int64GetDatumFast(X) PointerGetDatum(&(X)) +#define Float4GetDatumFast(X) PointerGetDatum(&(X)) +#define Float8GetDatumFast(X) PointerGetDatum(&(X)) + + /* ---------------------------------------------------------------- * Section 5: IsValid macros for system types * ---------------------------------------------------------------- -- cgit v1.2.3