Just a suggestion, how much work would it be to accept multiple parameters on
aggregate functions?

For instance:

select fubar(field1, field2) from table one group by field1;

The reason I think that this is useful is that for some statistical operations,
often times there is extra "per record" data that can affect how you calculate
a value.

Search Discussions

  • Mark L. Woodward at Aug 19, 2001 at 3:18 pm

    mlw wrote:

    Just a suggestion, how much work would it be to accept multiple parameters on
    aggregate functions?

    For instance:

    select fubar(field1, field2) from table one group by field1;

    The reason I think that this is useful is that for some statistical operations,
    often times there is extra "per record" data that can affect how you calculate
    a value.
    This would also be VERY helpful in a lot of OLAP type processing!

    create function aggfunct( int4, int4, int4 )
    returns int4
    as '/usr/local/lib/pglib.so', 'aggfunct'
    language 'c' ;

    create function aggterm( int4 )
    returns int4
    as '/usr/local/lib/pglib.so', 'aggterm'
    language 'c' ;

    create aggregate agg1 ( basetype = integer,
    sfunc1 = aggfunct, stype1 = integer,
    finalfunc = aggterm,
    initcond1 = 0 );


    In the above example, parameters 1 and 2 to aggfunct are the standard aggregate
    parameters are required by the "create aggrigate" syntax. At query time,
    however, the additional parameter(s) is used in addition.

    As an example of a more complex example, one could do something like this:

    select mycube_agg(region, date, sales, product) from salesinfo group by region;




    --
    5-4-3-2-1 Thunderbirds are GO!
    ------------------------
    http://www.mohawksoft.com

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-hackers @
categoriespostgresql
postedAug 18, '01 at 6:52p
activeAug 19, '01 at 3:18p
posts2
users1
websitepostgresql.org...
irc#postgresql

1 user in discussion

Mark L. Woodward: 2 posts

People

Translate

site design / logo © 2022 Grokbase