Re: Creating an aggregate function

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Creating an aggregate function
Дата
Msg-id 29842.968533416@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Creating an aggregate function  (Roberto Mello <rmello@cc.usu.edu>)
Список pgsql-sql
Roberto Mello <rmello@cc.usu.edu> writes:
> and our output was: 
>       date_id | n_sessions_day |  members  | non_members
>      ---------+----------------+-----------+-------------
>             1 |            500 |        30 |   136394044
>             2 |           2000 | 136394612 |   136394612 

In current sources I get the expected results if I write the
CREATE AGGREGATE commands withinitcond1 = '0');
Although the parser will accept unquoted integers as initcond
inputs, it looks like something downstream is mishandling them,
resulting in an invalid initial value entered into the pg_aggregate
entry for the aggregate.

I'll look into fixing that for 7.1, but in the meantime try putting
quotes around the initial values.

BTW, your agg_if_member function is not very good, because if it gets
more than one input row with member_p = 1 then the result is order-
dependent.  You don't want that.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Porting from mysql to psql (UNIX_TIMESTAMP()?)
Следующее
От: Max Pyziur
Дата:
Сообщение: "ORDER BY" issue - is this a bug?