diff options
| author | Tom Lane | 2008-12-28 18:54:01 +0000 |
|---|---|---|
| committer | Tom Lane | 2008-12-28 18:54:01 +0000 |
| commit | 95b07bc7f5010233f52f9d11da74e2e5b653b0a7 (patch) | |
| tree | 48f5858bf4eca1bfb316ef02bb959ca85f568e0a /contrib/tsearch2/tsearch2.c | |
| parent | 38e9348282e9d078487147ba8a85aebec54e3a08 (diff) | |
Support window functions a la SQL:2008.
Hitoshi Harada, with some kibitzing from Heikki and Tom.
Diffstat (limited to 'contrib/tsearch2/tsearch2.c')
| -rw-r--r-- | contrib/tsearch2/tsearch2.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/contrib/tsearch2/tsearch2.c b/contrib/tsearch2/tsearch2.c index 7754f574026..bdccba787a9 100644 --- a/contrib/tsearch2/tsearch2.c +++ b/contrib/tsearch2/tsearch2.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/contrib/tsearch2/tsearch2.c,v 1.6 2008/03/25 22:42:42 tgl Exp $ + * $PostgreSQL: pgsql/contrib/tsearch2/tsearch2.c,v 1.7 2008/12/28 18:53:53 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -410,7 +410,15 @@ tsa_rewrite_accum(PG_FUNCTION_ARGS) MemoryContext aggcontext; MemoryContext oldcontext; - aggcontext = ((AggState *) fcinfo->context)->aggcontext; + if (fcinfo->context && IsA(fcinfo->context, AggState)) + aggcontext = ((AggState *) fcinfo->context)->aggcontext; + else if (fcinfo->context && IsA(fcinfo->context, WindowAggState)) + aggcontext = ((WindowAggState *) fcinfo->context)->wincontext; + else + { + elog(ERROR, "tsa_rewrite_accum called in non-aggregate context"); + aggcontext = NULL; /* keep compiler quiet */ + } if (PG_ARGISNULL(0) || PG_GETARG_POINTER(0) == NULL) { |
