Re: [HACKERS] array_accum aggregate

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] array_accum aggregate
Дата
Msg-id 29129.1160747769@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] array_accum aggregate  (Martijn van Oosterhout <kleptog@svana.org>)
Ответы Re: [HACKERS] array_accum aggregate  (Stephen Frost <sfrost@snowman.net>)
Список pgsql-patches
Martijn van Oosterhout <kleptog@svana.org> writes:
> What this really calls for is a type that users are forbidden to
> interact with directly. Basically, the type may only be used by C
> functions and such C functions may not appear in an SQL query.

That's not really the flavor of solution I'd like to have.  Ideally,
it'd actually *work* to write

    my_ffunc(my_sfunc(my_sfunc(null, 1), 2))

and get the same result as aggregating over the values 1 and 2.  The
trick is to make sure that my_sfunc and my_ffunc can only be used
together.  Maybe we do need a type for each such aggregate ...

In any case, "internal" isn't quite the right model, because with that,
the type system is basically disclaiming all knowledge of the data's
properties.  With an "aggregate_state" datatype, the type system would
be asserting that it's OK to use this type (or more accurately, these
functions) in an aggregate.

            regards, tom lane

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

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: [HACKERS] array_accum aggregate
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: test_fsync on MinGW(win32)