Using a pointer as statetype for an aggregate - Mailing list pgsql-general

From Florian G. Pflug
Subject Using a pointer as statetype for an aggregate
Date
Msg-id 44572D07.6090307@phlo.org
Whole thread Raw
Responses Re: Using a pointer as statetype for an aggregate  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hi

I've now completed my implementation of a collect_distinct aggregate, and
it seems to work. My statetype is basically a pointer to a hashtable (allocated
from the aggcontext). Since using internal as statetype is unsupported,
I use int8, and just cast my pointer back and forth from int8.

It appears to work on both my dev (32bit) and my production (64bit) machine,
and it doesn't crash even when used heavily. Is there some drawback to my
approach? If not - why doesn't postgres allow "internal" as statetype?

greetings, Florian Pflug

pgsql-general by date:

Previous
From: Csaba Nagy
Date:
Subject: Re: Alternative for vacuuming queue-like tables
Next
From: Markus Schiltknecht
Date:
Subject: Unnecessary function calls