Re: Using a pointer as statetype for an aggregate

Поиск
Список
Период
Сортировка
От Florian G. Pflug
Тема Re: Using a pointer as statetype for an aggregate
Дата
Msg-id 44579CF9.1020409@phlo.org
обсуждение исходный текст
Ответ на Re: Using a pointer as statetype for an aggregate  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Tom Lane wrote:
 > "Florian G. Pflug" <fgp@phlo.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

В списке pgsql-general по дате отправления:

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Unexpected behavior
Следующее
От: Don Y
Дата:
Сообщение: Re: PG_RETURN_?