Re: Using a pointer as statetype for an aggregate

From: "Florian G(dot) Pflug" <fgp(at)phlo(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Postgresql-General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Using a pointer as statetype for an aggregate
Date: 2006-05-02 17:55:05
Message-ID: 44579CF9.1020409@phlo.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:
> "Florian G. Pflug" <fgp(at)phlo(dot)org> writes:
>>why doesn't postgres allow "internal" as statetype?
>
> Because it's not a type. If it were, it certainly wouldn't have the
> semantics you seem to hope for (ie, "pass by reference type but don't
> actually try to copy the bits")

Could I somehow define a type that would fit my needs. Ideally,
it would be
1) pass-by-value
2) 4byte long on 32bit machines
3) 8byte long on 64bit machines
4) Only "0" can be castet to my type, resulting in an all-zero representation
5) Impossible to use as a column type
6) Provide no output function, because the value is meaningless to the user.

I'd think I'd manage to get 4, 6 and maybe 5 working by playing with "create type".
But I can't see how I could make 1,2 and 3 work. Is an 8byte pass-by-value type
even possible?

I'd realy like to get rid of that ugly casting to int8.. It just seems soooo wrong ;-)

greetings, Florian Pflug

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Don Y 2006-05-02 18:13:31 Re: PG_RETURN_?
Previous Message Martijn van Oosterhout 2006-05-02 17:53:18 Re: Unexpected behavior